<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Stg to C-- code generation: bindings</span><span>
</span><span id="line-4"></span><span class="hs-comment">--</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- (c) The University of Glasgow 2004-2006</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.StgToCmm.Bind</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-10"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgTopRhsClosure"><span class="hs-identifier">cgTopRhsClosure</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgBind"><span class="hs-identifier">cgBind</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Bind.html#emitBlackHoleCode"><span class="hs-identifier">emitBlackHoleCode</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Bind.html#pushUpdateFrame"><span class="hs-identifier">pushUpdateFrame</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Bind.html#emitUpdateFrame"><span class="hs-identifier">emitUpdateFrame</span></a></span><span>
</span><span id="line-14"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator">(&lt;*&gt;)</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Expr.html"><span class="hs-identifier">GHC.StgToCmm.Expr</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html"><span class="hs-identifier">GHC.StgToCmm.Monad</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Env.html"><span class="hs-identifier">GHC.StgToCmm.Env</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.DataCon.html"><span class="hs-identifier">GHC.StgToCmm.DataCon</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Heap.html"><span class="hs-identifier">GHC.StgToCmm.Heap</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Prof.html"><span class="hs-identifier">GHC.StgToCmm.Prof</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Prof.html#ldvEnterClosure"><span class="hs-identifier">ldvEnterClosure</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Prof.html#enterCostCentreFun"><span class="hs-identifier">enterCostCentreFun</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Prof.html#enterCostCentreThunk"><span class="hs-identifier">enterCostCentreThunk</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>                   </span><span class="annot"><a href="GHC.StgToCmm.Prof.html#initUpdFrameProf"><span class="hs-identifier">initUpdFrameProf</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Ticky.html"><span class="hs-identifier">GHC.StgToCmm.Ticky</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html"><span class="hs-identifier">GHC.StgToCmm.Layout</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Utils.html"><span class="hs-identifier">GHC.StgToCmm.Utils</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html"><span class="hs-identifier">GHC.StgToCmm.Closure</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Foreign.html"><span class="hs-identifier">GHC.StgToCmm.Foreign</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Foreign.html#emitPrimCall"><span class="hs-identifier">emitPrimCall</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Graph.html"><span class="hs-identifier">GHC.Cmm.Graph</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span>          </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.html#AltCon"><span class="hs-identifier">AltCon</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#tickishIsCode"><span class="hs-identifier">tickishIsCode</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html"><span class="hs-identifier">GHC.Cmm.BlockId</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html"><span class="hs-identifier">GHC.Runtime.Heap.Layout</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.html"><span class="hs-identifier">GHC.Cmm</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Info.html"><span class="hs-identifier">GHC.Cmm.Info</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Utils.html"><span class="hs-identifier">GHC.Cmm.Utils</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html"><span class="hs-identifier">GHC.Cmm.CLabel</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html"><span class="hs-identifier">GHC.Stg.Syntax</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html"><span class="hs-identifier">GHC.Types.CostCentre</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html"><span class="hs-identifier">GHC.Types.Id.Info</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html"><span class="hs-identifier">GHC.Data.List.SetOps</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-57"></span><span class="hs-comment">--              Top-level bindings</span><span>
</span><span id="line-58"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="hs-comment">-- For closures bound at top level, allocate in static space.</span><span>
</span><span id="line-61"></span><span class="hs-comment">-- They should have no free variables.</span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgTopRhsClosure"><span class="hs-identifier hs-type">cgTopRhsClosure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-64"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span>              </span><span class="hs-comment">-- member of a recursive group?</span><span>
</span><span id="line-65"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-66"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CostCentreStack"><span class="hs-identifier hs-type">CostCentreStack</span></a></span><span>      </span><span class="hs-comment">-- Optional cost centre annotation</span><span>
</span><span id="line-67"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#UpdateFlag"><span class="hs-identifier hs-type">UpdateFlag</span></a></span><span>
</span><span id="line-68"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>                 </span><span class="hs-comment">-- Args</span><span>
</span><span id="line-69"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgExpr"><span class="hs-identifier hs-type">CgStgExpr</span></a></span><span>
</span><span id="line-70"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Monad.html#CgIdInfo"><span class="hs-identifier hs-type">CgIdInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span id="cgTopRhsClosure"><span class="annot"><span class="annottext">cgTopRhsClosure :: DynFlags
-&gt; RecFlag
-&gt; Id
-&gt; CostCentreStack
-&gt; UpdateFlag
-&gt; [Id]
-&gt; CgStgExpr
-&gt; (CgIdInfo, FCode ())
</span><a href="GHC.StgToCmm.Bind.html#cgTopRhsClosure"><span class="hs-identifier hs-var hs-var">cgTopRhsClosure</span></a></span></span><span> </span><span id="local-6989586621681061405"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061405"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681061404"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681061404"><span class="hs-identifier hs-var">rec</span></a></span></span><span> </span><span id="local-6989586621681061403"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681061402"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061402"><span class="hs-identifier hs-var">ccs</span></a></span></span><span> </span><span id="local-6989586621681061401"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061401"><span class="hs-identifier hs-var">upd_flag</span></a></span></span><span> </span><span id="local-6989586621681061400"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061400"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681061399"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061399"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-73"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061398"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681061398"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061405"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-74"></span><span>      </span><span id="local-6989586621681061396"><span class="annot"><span class="annottext">closure_label :: CLabel
</span><a href="#local-6989586621681061396"><span class="hs-identifier hs-var hs-var">closure_label</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; CafInfo -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkLocalClosureLabel"><span class="hs-identifier hs-var">mkLocalClosureLabel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CafInfo
</span><a href="GHC.Types.Id.html#idCafInfo"><span class="hs-identifier hs-var">idCafInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-75"></span><span>      </span><span id="local-6989586621681061392"><span class="annot"><span class="annottext">cg_id_info :: CgIdInfo
</span><a href="#local-6989586621681061392"><span class="hs-identifier hs-var hs-var">cg_id_info</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Id -&gt; LambdaFormInfo -&gt; CmmLit -&gt; CgIdInfo
</span><a href="GHC.StgToCmm.Env.html#litIdInfo"><span class="hs-identifier hs-var">litIdInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061405"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061390"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabel -&gt; CmmLit
</span><a href="GHC.Cmm.Expr.html#CmmLabel"><span class="hs-identifier hs-var">CmmLabel</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061396"><span class="hs-identifier hs-var">closure_label</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-76"></span><span>      </span><span id="local-6989586621681061390"><span class="annot"><span class="annottext">lf_info :: LambdaFormInfo
</span><a href="#local-6989586621681061390"><span class="hs-identifier hs-var hs-var">lf_info</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform
-&gt; Id
-&gt; TopLevelFlag
-&gt; [NonVoid Id]
-&gt; UpdateFlag
-&gt; [Id]
-&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Bind.html#mkClosureLFInfo"><span class="hs-identifier hs-var">mkClosureLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061398"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#TopLevel"><span class="hs-identifier hs-var">TopLevel</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061401"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061400"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-77"></span><span>  </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061392"><span class="hs-identifier hs-var">cg_id_info</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; LambdaFormInfo -&gt; CLabel -&gt; FCode ()
</span><a href="#local-6989586621681061386"><span class="hs-identifier hs-var">gen_code</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061405"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061390"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061396"><span class="hs-identifier hs-var">closure_label</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-78"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-79"></span><span>  </span><span class="hs-comment">-- special case for a indirection (f = g).  We create an IND_STATIC</span><span>
</span><span id="line-80"></span><span>  </span><span class="hs-comment">-- closure pointing directly to the indirectee.  This is exactly</span><span>
</span><span id="line-81"></span><span>  </span><span class="hs-comment">-- what the CAF will eventually evaluate to anyway, we're just</span><span>
</span><span id="line-82"></span><span>  </span><span class="hs-comment">-- shortcutting the whole process, and generating a lot less code</span><span>
</span><span id="line-83"></span><span>  </span><span class="hs-comment">-- (#7308). Eventually the IND_STATIC closure will be eliminated</span><span>
</span><span id="line-84"></span><span>  </span><span class="hs-comment">-- by assembly '.equiv' directives, where possible (#15155).</span><span>
</span><span id="line-85"></span><span>  </span><span class="hs-comment">-- See note [emit-time elimination of static indirections] in &quot;GHC.Cmm.CLabel&quot;.</span><span>
</span><span id="line-86"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-87"></span><span>  </span><span class="hs-comment">-- Note: we omit the optimisation when this binding is part of a</span><span>
</span><span id="line-88"></span><span>  </span><span class="hs-comment">-- recursive group, because the optimisation would inhibit the black</span><span>
</span><span id="line-89"></span><span>  </span><span class="hs-comment">-- hole detection from working in that case.  Test</span><span>
</span><span id="line-90"></span><span>  </span><span class="hs-comment">-- concurrent/should_run/4030 fails, for instance.</span><span>
</span><span id="line-91"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-92"></span><span>  </span><span id="local-6989586621681061386"><span class="annot"><span class="annottext">gen_code :: DynFlags -&gt; LambdaFormInfo -&gt; CLabel -&gt; FCode ()
</span><a href="#local-6989586621681061386"><span class="hs-identifier hs-var hs-var">gen_code</span></a></span></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681061380"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061380"><span class="hs-identifier hs-var">closure_label</span></a></span></span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-type">StgApp</span></a></span><span> </span><span id="local-6989586621681061378"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061378"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061399"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061400"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RecFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#isNonRec"><span class="hs-identifier hs-var">isNonRec</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681061404"><span class="hs-identifier hs-var">rec</span></a></span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-95"></span><span>         </span><span id="local-6989586621681061375"><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061375"><span class="hs-identifier hs-var">cg_info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; FCode CgIdInfo
</span><a href="GHC.StgToCmm.Env.html#getCgIdInfo"><span class="hs-identifier hs-var">getCgIdInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061378"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-96"></span><span>         </span><span class="annot"><span class="annottext">CLabel -&gt; CmmInfoTable -&gt; CostCentreStack -&gt; [CmmLit] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Utils.html#emitDataCon"><span class="hs-identifier hs-var">emitDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061380"><span class="hs-identifier hs-var">closure_label</span></a></span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="GHC.StgToCmm.Closure.html#indStaticInfoTable"><span class="hs-identifier hs-var">indStaticInfoTable</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061402"><span class="hs-identifier hs-var">ccs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CmmExpr -&gt; CmmLit
</span><a href="#local-6989586621681061371"><span class="hs-identifier hs-var">unLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CgIdInfo -&gt; CmmExpr
</span><a href="GHC.StgToCmm.Env.html#idInfoToAmode"><span class="hs-identifier hs-var">idInfoToAmode</span></a></span><span> </span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061375"><span class="hs-identifier hs-var">cg_info</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span>  </span><span class="annot"><a href="#local-6989586621681061386"><span class="hs-identifier hs-var">gen_code</span></a></span><span> </span><span id="local-6989586621681061369"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061369"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681061368"><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061368"><span class="hs-identifier hs-var">lf_info</span></a></span></span><span> </span><span id="local-6989586621681061367"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061367"><span class="hs-identifier hs-var">_closure_label</span></a></span></span><span>
</span><span id="line-99"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061366"><span class="annot"><span class="annottext">name :: Name
</span><a href="#local-6989586621681061366"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-100"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061365"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681061365"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Module
</span><a href="GHC.StgToCmm.Monad.html#getModuleName"><span class="hs-identifier hs-var">getModuleName</span></a></span><span>
</span><span id="line-101"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061363"><span class="annot"><span class="annottext">descr :: String
</span><a href="#local-6989586621681061363"><span class="hs-identifier hs-var hs-var">descr</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Module -&gt; Name -&gt; String
</span><a href="GHC.StgToCmm.Bind.html#closureDescription"><span class="hs-identifier hs-var">closureDescription</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061369"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681061365"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681061366"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-102"></span><span>              </span><span id="local-6989586621681061361"><span class="annot"><span class="annottext">closure_info :: ClosureInfo
</span><a href="#local-6989586621681061361"><span class="hs-identifier hs-var hs-var">closure_info</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Bool
-&gt; Id
-&gt; LambdaFormInfo
-&gt; WordOff
-&gt; WordOff
-&gt; String
-&gt; ClosureInfo
</span><a href="GHC.StgToCmm.Closure.html#mkClosureInfo"><span class="hs-identifier hs-var">mkClosureInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061369"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061368"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681061363"><span class="hs-identifier hs-var">descr</span></a></span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span>        </span><span class="hs-comment">-- We don't generate the static closure here, because we might</span><span>
</span><span id="line-105"></span><span>        </span><span class="hs-comment">-- want to add references to static closures to it later.  The</span><span>
</span><span id="line-106"></span><span>        </span><span class="hs-comment">-- static closure is generated by GHC.Cmm.Info.Build.updInfoSRTs,</span><span>
</span><span id="line-107"></span><span>        </span><span class="hs-comment">-- See Note [SRTs], specifically the [FUN] optimisation.</span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681061359"><span class="hs-identifier hs-type">fv_details</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-110"></span><span>              </span><span id="local-6989586621681061357"><span class="annot"><span class="annottext">header :: ClosureHeader
</span><a href="#local-6989586621681061357"><span class="hs-identifier hs-var hs-var">header</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#isLFThunk"><span class="hs-identifier hs-var">isLFThunk</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061368"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#ThunkHeader"><span class="hs-identifier hs-var">ThunkHeader</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#StdHeader"><span class="hs-identifier hs-var">StdHeader</span></a></span><span>
</span><span id="line-111"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061359"><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061359"><span class="hs-identifier hs-var">fv_details</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, Id)]
-&gt; (WordOff, WordOff, [(NonVoid Id, WordOff)])
forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (WordOff, WordOff, [(NonVoid a, WordOff)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier hs-var">mkVirtHeapOffsets</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061369"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="#local-6989586621681061357"><span class="hs-identifier hs-var">header</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-112"></span><span>        </span><span class="hs-comment">-- Don't drop the non-void args until the closure info has been made</span><span>
</span><span id="line-113"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#forkClosureBody"><span class="hs-identifier hs-var">forkClosureBody</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
-&gt; Id
-&gt; ClosureInfo
-&gt; CostCentreStack
-&gt; [Id]
-&gt; CgStgExpr
-&gt; [(NonVoid Id, WordOff)]
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#closureCodeBody"><span class="hs-identifier hs-var">closureCodeBody</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061403"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061361"><span class="hs-identifier hs-var">closure_info</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061402"><span class="hs-identifier hs-var">ccs</span></a></span><span>
</span><span id="line-114"></span><span>                                </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061400"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061399"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061359"><span class="hs-identifier hs-var">fv_details</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">() -&gt; FCode ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span>  </span><span id="local-6989586621681061371"><span class="annot"><span class="annottext">unLit :: CmmExpr -&gt; CmmLit
</span><a href="#local-6989586621681061371"><span class="hs-identifier hs-var hs-var">unLit</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmLit"><span class="hs-identifier hs-type">CmmLit</span></a></span><span> </span><span id="local-6989586621681061349"><span class="annot"><span class="annottext">CmmLit
</span><a href="#local-6989586621681061349"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmLit
</span><a href="#local-6989586621681061349"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-119"></span><span>  </span><span class="annot"><a href="#local-6989586621681061371"><span class="hs-identifier hs-var">unLit</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; CmmLit
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unLit&quot;</span></span><span>
</span><span id="line-120"></span><span>
</span><span id="line-121"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-122"></span><span class="hs-comment">--              Non-top-level bindings</span><span>
</span><span id="line-123"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgBind"><span class="hs-identifier hs-type">cgBind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgBinding"><span class="hs-identifier hs-type">CgStgBinding</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-126"></span><span id="cgBind"><span class="annot"><span class="annottext">cgBind :: CgStgBinding -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#cgBind"><span class="hs-identifier hs-var hs-var">cgBind</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgNonRec"><span class="hs-identifier hs-type">StgNonRec</span></a></span><span> </span><span id="local-6989586621681061346"><span class="annot"><span class="annottext">BinderP 'CodeGen
</span><a href="#local-6989586621681061346"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681061345"><span class="annot"><span class="annottext">GenStgRhs 'CodeGen
</span><a href="#local-6989586621681061345"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681061344"><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061344"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061343"><span class="annot"><span class="annottext">FCode CmmAGraph
</span><a href="#local-6989586621681061343"><span class="hs-identifier hs-var">fcode</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; GenStgRhs 'CodeGen -&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#cgRhs"><span class="hs-identifier hs-var">cgRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Id
BinderP 'CodeGen
</span><a href="#local-6989586621681061346"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgRhs 'CodeGen
</span><a href="#local-6989586621681061345"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-128"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CgIdInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.Env.html#addBindC"><span class="hs-identifier hs-var">addBindC</span></a></span><span> </span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061344"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-129"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061340"><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681061340"><span class="hs-identifier hs-var">init</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode CmmAGraph
</span><a href="#local-6989586621681061343"><span class="hs-identifier hs-var">fcode</span></a></span><span>
</span><span id="line-130"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681061340"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-131"></span><span>        </span><span class="hs-comment">-- init cannot be used in body, so slightly better to sink it eagerly</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgBind"><span class="hs-identifier hs-var">cgBind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRec"><span class="hs-identifier hs-type">StgRec</span></a></span><span> </span><span id="local-6989586621681061337"><span class="annot"><span class="annottext">[(BinderP 'CodeGen, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681061337"><span class="hs-identifier hs-var">pairs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-134"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span>  </span><span id="local-6989586621681061336"><span class="annot"><span class="annottext">[(CgIdInfo, FCode CmmAGraph)]
</span><a href="#local-6989586621681061336"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[FCode (CgIdInfo, FCode CmmAGraph)]
-&gt; FCode [(CgIdInfo, FCode CmmAGraph)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a.
(Traversable t, Monad m) =&gt;
t (m a) -&gt; m (t a)
</span><a href="../../base/src/Data.Traversable.html#sequence"><span class="hs-identifier hs-var">sequence</span></a></span><span> </span><span class="annot"><span class="annottext">([FCode (CgIdInfo, FCode CmmAGraph)]
 -&gt; FCode [(CgIdInfo, FCode CmmAGraph)])
-&gt; [FCode (CgIdInfo, FCode CmmAGraph)]
-&gt; FCode [(CgIdInfo, FCode CmmAGraph)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; GenStgRhs 'CodeGen -&gt; FCode (CgIdInfo, FCode CmmAGraph))
-&gt; [(Id, GenStgRhs 'CodeGen)]
-&gt; [FCode (CgIdInfo, FCode CmmAGraph)]
forall a b c. (a -&gt; b -&gt; c) -&gt; [(a, b)] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#unzipWith"><span class="hs-identifier hs-var">unzipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; GenStgRhs 'CodeGen -&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#cgRhs"><span class="hs-identifier hs-var">cgRhs</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'CodeGen)]
[(BinderP 'CodeGen, GenStgRhs 'CodeGen)]
</span><a href="#local-6989586621681061337"><span class="hs-identifier hs-var">pairs</span></a></span><span>
</span><span id="line-135"></span><span>        </span><span class="hs-special">;</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681061333"><span class="annot"><span class="annottext">[CgIdInfo]
</span><a href="#local-6989586621681061333"><span class="hs-identifier hs-var">id_infos</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061332"><span class="annot"><span class="annottext">[FCode CmmAGraph]
</span><a href="#local-6989586621681061332"><span class="hs-identifier hs-var">fcodes</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(CgIdInfo, FCode CmmAGraph)] -&gt; ([CgIdInfo], [FCode CmmAGraph])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">[(CgIdInfo, FCode CmmAGraph)]
</span><a href="#local-6989586621681061336"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-136"></span><span>        </span><span class="hs-special">;</span><span>  </span><span class="annot"><span class="annottext">[CgIdInfo] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Env.html#addBindsC"><span class="hs-identifier hs-var">addBindsC</span></a></span><span> </span><span class="annot"><span class="annottext">[CgIdInfo]
</span><a href="#local-6989586621681061333"><span class="hs-identifier hs-var">id_infos</span></a></span><span>
</span><span id="line-137"></span><span>        </span><span class="hs-special">;</span><span>  </span><span class="hs-special">(</span><span id="local-6989586621681061329"><span class="annot"><span class="annottext">[CmmAGraph]
</span><a href="#local-6989586621681061329"><span class="hs-identifier hs-var">inits</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061328"><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681061328"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode [CmmAGraph] -&gt; FCode ([CmmAGraph], CmmAGraph)
forall a. FCode a -&gt; FCode (a, CmmAGraph)
</span><a href="GHC.StgToCmm.Monad.html#getCodeR"><span class="hs-identifier hs-var">getCodeR</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode [CmmAGraph] -&gt; FCode ([CmmAGraph], CmmAGraph))
-&gt; FCode [CmmAGraph] -&gt; FCode ([CmmAGraph], CmmAGraph)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[FCode CmmAGraph] -&gt; FCode [CmmAGraph]
forall (t :: * -&gt; *) (m :: * -&gt; *) a.
(Traversable t, Monad m) =&gt;
t (m a) -&gt; m (t a)
</span><a href="../../base/src/Data.Traversable.html#sequence"><span class="hs-identifier hs-var">sequence</span></a></span><span> </span><span class="annot"><span class="annottext">[FCode CmmAGraph]
</span><a href="#local-6989586621681061332"><span class="hs-identifier hs-var">fcodes</span></a></span><span>
</span><span id="line-138"></span><span>        </span><span class="hs-special">;</span><span>  </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[CmmAGraph] -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#catAGraphs"><span class="hs-identifier hs-var">catAGraphs</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmAGraph]
</span><a href="#local-6989586621681061329"><span class="hs-identifier hs-var">inits</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681061328"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="hs-comment">{- Note [cgBind rec]

   Recursive let-bindings are tricky.
   Consider the following pseudocode:

     let x = \_ -&gt;  ... y ...
         y = \_ -&gt;  ... z ...
         z = \_ -&gt;  ... x ...
     in ...

   For each binding, we need to allocate a closure, and each closure must
   capture the address of the other closures.
   We want to generate the following C-- code:
     // Initialization Code
     x = hp - 24; // heap address of x's closure
     y = hp - 40; // heap address of x's closure
     z = hp - 64; // heap address of x's closure
     // allocate and initialize x
     m[hp-8]   = ...
     m[hp-16]  = y       // the closure for x captures y
     m[hp-24] = x_info;
     // allocate and initialize y
     m[hp-32] = z;       // the closure for y captures z
     m[hp-40] = y_info;
     // allocate and initialize z
     ...

   For each closure, we must generate not only the code to allocate and
   initialize the closure itself, but also some initialization Code that
   sets a variable holding the closure pointer.

   We could generate a pair of the (init code, body code), but since
   the bindings are recursive we also have to initialise the
   environment with the CgIdInfo for all the bindings before compiling
   anything.  So we do this in 3 stages:

     1. collect all the CgIdInfos and initialise the environment
     2. compile each binding into (init, body) code
     3. emit all the inits, and then all the bodies

   We'd rather not have separate functions to do steps 1 and 2 for
   each binding, since in practice they share a lot of code.  So we
   have just one function, cgRhs, that returns a pair of the CgIdInfo
   for step 1, and a monadic computation to generate the code in step
   2.

   The alternative to separating things in this way is to use a
   fixpoint.  That's what we used to do, but it introduces a
   maintenance nightmare because there is a subtle dependency on not
   being too strict everywhere.  Doing things this way means that the
   FCode monad can be strict, for example.
 -}</span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgRhs"><span class="hs-identifier hs-type">cgRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-194"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgRhs"><span class="hs-identifier hs-type">CgStgRhs</span></a></span><span>
</span><span id="line-195"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-196"></span><span>                 </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#CgIdInfo"><span class="hs-identifier hs-type">CgIdInfo</span></a></span><span>         </span><span class="hs-comment">-- The info for this binding</span><span>
</span><span id="line-197"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Graph.html#CmmAGraph"><span class="hs-identifier hs-type">CmmAGraph</span></a></span><span>  </span><span class="hs-comment">-- A computation which will generate the</span><span>
</span><span id="line-198"></span><span>                                  </span><span class="hs-comment">-- code for the binding, and return an</span><span>
</span><span id="line-199"></span><span>                                  </span><span class="hs-comment">-- assignment of the form &quot;x = Hp - n&quot;</span><span>
</span><span id="line-200"></span><span>                                  </span><span class="hs-comment">-- (see above)</span><span>
</span><span id="line-201"></span><span>               </span><span class="hs-special">)</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span id="cgRhs"><span class="annot"><span class="annottext">cgRhs :: Id -&gt; GenStgRhs 'CodeGen -&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#cgRhs"><span class="hs-identifier hs-var hs-var">cgRhs</span></a></span></span><span> </span><span id="local-6989586621681061323"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061323"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-type">StgRhsCon</span></a></span><span> </span><span id="local-6989586621681061321"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061321"><span class="hs-identifier hs-var">cc</span></a></span></span><span> </span><span id="local-6989586621681061320"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681061320"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681061319"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061319"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
-&gt; DataCon
-&gt; FCode (CgIdInfo, FCode CmmAGraph)
-&gt; FCode (CgIdInfo, FCode CmmAGraph)
forall a. Name -&gt; DataCon -&gt; FCode a -&gt; FCode a
</span><a href="GHC.StgToCmm.Ticky.html#withNewTickyCounterCon"><span class="hs-identifier hs-var">withNewTickyCounterCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061323"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681061320"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode (CgIdInfo, FCode CmmAGraph)
 -&gt; FCode (CgIdInfo, FCode CmmAGraph))
-&gt; FCode (CgIdInfo, FCode CmmAGraph)
-&gt; FCode (CgIdInfo, FCode CmmAGraph)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-205"></span><span>    </span><span class="annot"><span class="annottext">Id
-&gt; Bool
-&gt; CostCentreStack
-&gt; DataCon
-&gt; [NonVoid StgArg]
-&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.DataCon.html#buildDynCon"><span class="hs-identifier hs-var">buildDynCon</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061323"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061321"><span class="hs-identifier hs-var">cc</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681061320"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[StgArg] -&gt; [NonVoid StgArg]
</span><a href="GHC.StgToCmm.Closure.html#assertNonVoidStgArgs"><span class="hs-identifier hs-var">assertNonVoidStgArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061319"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-206"></span><span>      </span><span class="hs-comment">-- con args are always non-void,</span><span>
</span><span id="line-207"></span><span>      </span><span class="hs-comment">-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise</span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span class="hs-comment">{- See Note [GC recovery] in &quot;GHC.StgToCmm.Closure&quot; -}</span><span>
</span><span id="line-210"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgRhs"><span class="hs-identifier hs-var">cgRhs</span></a></span><span> </span><span id="local-6989586621681061315"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061315"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-type">StgRhsClosure</span></a></span><span> </span><span id="local-6989586621681061313"><span class="annot"><span class="annottext">XRhsClosure 'CodeGen
</span><a href="#local-6989586621681061313"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621681061312"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061312"><span class="hs-identifier hs-var">cc</span></a></span></span><span> </span><span id="local-6989586621681061311"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061311"><span class="hs-identifier hs-var">upd_flag</span></a></span></span><span> </span><span id="local-6989586621681061310"><span class="annot"><span class="annottext">[BinderP 'CodeGen]
</span><a href="#local-6989586621681061310"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681061309"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061309"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681061308"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061308"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-212"></span><span>       </span><span class="annot"><span class="annottext">DynFlags
-&gt; Id
-&gt; CostCentreStack
-&gt; [NonVoid Id]
-&gt; UpdateFlag
-&gt; [Id]
-&gt; CgStgExpr
-&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#mkRhsClosure"><span class="hs-identifier hs-var">mkRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061308"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061315"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061312"><span class="hs-identifier hs-var">cc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; [NonVoid Id]
</span><a href="GHC.StgToCmm.Closure.html#nonVoidIds"><span class="hs-identifier hs-var">nonVoidIds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DVarSet -&gt; [Id]
</span><a href="GHC.Types.Var.Set.html#dVarSetElems"><span class="hs-identifier hs-var">dVarSetElems</span></a></span><span> </span><span class="annot"><span class="annottext">DVarSet
XRhsClosure 'CodeGen
</span><a href="#local-6989586621681061313"><span class="hs-identifier hs-var">fvs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061311"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[BinderP 'CodeGen]
</span><a href="#local-6989586621681061310"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061309"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-215"></span><span class="hs-comment">--              Non-constructor right hand sides</span><span>
</span><span id="line-216"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#mkRhsClosure"><span class="hs-identifier hs-type">mkRhsClosure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CostCentreStack"><span class="hs-identifier hs-type">CostCentreStack</span></a></span><span>
</span><span id="line-219"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>                    </span><span class="hs-comment">-- Free vars</span><span>
</span><span id="line-220"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#UpdateFlag"><span class="hs-identifier hs-type">UpdateFlag</span></a></span><span>
</span><span id="line-221"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>                            </span><span class="hs-comment">-- Args</span><span>
</span><span id="line-222"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgExpr"><span class="hs-identifier hs-type">CgStgExpr</span></a></span><span>
</span><span id="line-223"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Monad.html#CgIdInfo"><span class="hs-identifier hs-type">CgIdInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Graph.html#CmmAGraph"><span class="hs-identifier hs-type">CmmAGraph</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span class="hs-comment">{- mkRhsClosure looks for two special forms of the right-hand side:
        a) selector thunks
        b) AP thunks

If neither happens, it just calls mkClosureLFInfo.  You might think
that mkClosureLFInfo should do all this, but it seems wrong for the
latter to look at the structure of an expression

Note [Selectors]
~~~~~~~~~~~~~~~~
We look at the body of the closure to see if it's a selector---turgid,
but nothing deep.  We are looking for a closure of {\em exactly} the
form:

...  = [the_fv] \ u [] -&gt;
         case the_fv of
           con a_1 ... a_n -&gt; a_i

Note [Ap thunks]
~~~~~~~~~~~~~~~~
A more generic AP thunk of the form

        x = [ x_1...x_n ] \.. [] -&gt; x_1 ... x_n

A set of these is compiled statically into the RTS, so we just use
those.  We could extend the idea to thunks where some of the x_i are
global ids (and hence not free variables), but this would entail
generating a larger thunk.  It might be an option for non-optimising
compilation, though.

We only generate an Ap thunk if all the free variables are pointers,
for semi-obvious reasons.

-}</span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span class="hs-comment">---------- Note [Selectors] ------------------</span><span>
</span><span id="line-261"></span><span id="mkRhsClosure"><span class="annot"><span class="annottext">mkRhsClosure :: DynFlags
-&gt; Id
-&gt; CostCentreStack
-&gt; [NonVoid Id]
-&gt; UpdateFlag
-&gt; [Id]
-&gt; CgStgExpr
-&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#mkRhsClosure"><span class="hs-identifier hs-var hs-var">mkRhsClosure</span></a></span></span><span>    </span><span id="local-6989586621681061303"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061303"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681061302"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061302"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061301"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061301"><span class="hs-identifier hs-var">_cc</span></a></span></span><span>
</span><span id="line-262"></span><span>                </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span id="local-6989586621681061299"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061299"><span class="hs-identifier hs-var">the_fv</span></a></span></span><span class="hs-special">]</span><span>                </span><span class="hs-comment">-- Just one free var</span><span>
</span><span id="line-263"></span><span>                </span><span id="local-6989586621681061298"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061298"><span class="hs-identifier hs-var">upd_flag</span></a></span></span><span>                </span><span class="hs-comment">-- Updatable thunk</span><span>
</span><span id="line-264"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                      </span><span class="hs-comment">-- A thunk</span><span>
</span><span id="line-265"></span><span>                </span><span id="local-6989586621681061297"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061297"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-266"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061296"><span class="annot"><span class="annottext">strip :: GenStgExpr p -&gt; GenStgExpr p
</span><a href="#local-6989586621681061296"><span class="hs-identifier hs-var hs-var">strip</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Tickish Id -&gt; Bool) -&gt; GenStgExpr p -&gt; GenStgExpr p
forall (p :: StgPass).
(Tickish Id -&gt; Bool) -&gt; GenStgExpr p -&gt; GenStgExpr p
</span><a href="GHC.Stg.Syntax.html#stripStgTicksTopE"><span class="hs-identifier hs-var">stripStgTicksTopE</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Tickish Id -&gt; Bool) -&gt; Tickish Id -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; Bool
forall id. Tickish id -&gt; Bool
</span><a href="GHC.Core.html#tickishIsCode"><span class="hs-identifier hs-var">tickishIsCode</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-267"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgCase"><span class="hs-identifier hs-type">StgCase</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-type">StgApp</span></a></span><span> </span><span id="local-6989586621681061291"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061291"><span class="hs-identifier hs-var">scrutinee</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-comment">{-no args-}</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span>         </span><span class="annot"><span class="annottext">BinderP 'CodeGen
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-comment">-- ignore bndr</span><span>
</span><span id="line-269"></span><span>         </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#AlgAlt"><span class="hs-identifier hs-type">AlgAlt</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span>         </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-type">DataAlt</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061288"><span class="annot"><span class="annottext">[BinderP 'CodeGen]
</span><a href="#local-6989586621681061288"><span class="hs-identifier hs-var">params</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061287"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061287"><span class="hs-identifier hs-var">sel_expr</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; CgStgExpr
forall {p :: StgPass}. GenStgExpr p -&gt; GenStgExpr p
</span><a href="#local-6989586621681061296"><span class="hs-identifier hs-var">strip</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061297"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-271"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-type">StgApp</span></a></span><span> </span><span id="local-6989586621681061286"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061286"><span class="hs-identifier hs-var">selectee</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-comment">{-no args-}</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; CgStgExpr
forall {p :: StgPass}. GenStgExpr p -&gt; GenStgExpr p
</span><a href="#local-6989586621681061296"><span class="hs-identifier hs-var">strip</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061287"><span class="hs-identifier hs-var">sel_expr</span></a></span><span>
</span><span id="line-272"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061299"><span class="hs-identifier hs-var">the_fv</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Id -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061291"><span class="hs-identifier hs-var">scrutinee</span></a></span><span>                </span><span class="hs-comment">-- Scrutinee is the only free variable</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061285"><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061285"><span class="hs-identifier hs-var">params_w_offsets</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; [NonVoid (PrimRep, Id)]
-&gt; (WordOff, WordOff, [(NonVoid Id, WordOff)])
forall a.
DynFlags
-&gt; [NonVoid (PrimRep, a)]
-&gt; (WordOff, WordOff, [(NonVoid a, WordOff)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtConstrOffsets"><span class="hs-identifier hs-var">mkVirtConstrOffsets</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061303"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NonVoid Id] -&gt; [NonVoid (PrimRep, Id)]
</span><a href="GHC.StgToCmm.Closure.html#addIdReps"><span class="hs-identifier hs-var">addIdReps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; [NonVoid Id]
</span><a href="GHC.StgToCmm.Closure.html#assertNonVoidIds"><span class="hs-identifier hs-var">assertNonVoidIds</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[BinderP 'CodeGen]
</span><a href="#local-6989586621681061288"><span class="hs-identifier hs-var">params</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span>                                   </span><span class="hs-comment">-- pattern binders are always non-void,</span><span>
</span><span id="line-276"></span><span>                                   </span><span class="hs-comment">-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise</span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681061281"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061281"><span class="hs-identifier hs-var">the_offset</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)] -&gt; NonVoid Id -&gt; Maybe WordOff
forall a b. Eq a =&gt; Assoc a b -&gt; a -&gt; Maybe b
</span><a href="GHC.Data.List.SetOps.html#assocMaybe"><span class="hs-identifier hs-var">assocMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061285"><span class="hs-identifier hs-var">params_w_offsets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; NonVoid Id
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061286"><span class="hs-identifier hs-var">selectee</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061278"><span class="annot"><span class="annottext">offset_into_int :: WordOff
</span><a href="#local-6989586621681061278"><span class="hs-identifier hs-var hs-var">offset_into_int</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; WordOff -&gt; WordOff
</span><a href="GHC.Runtime.Heap.Layout.html#bytesToWordsRoundUp"><span class="hs-identifier hs-var">bytesToWordsRoundUp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061303"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061281"><span class="hs-identifier hs-var">the_offset</span></a></span><span>
</span><span id="line-280"></span><span>                          </span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; WordOff
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Runtime.Heap.Layout.html#fixedHdrSizeW"><span class="hs-identifier hs-var">fixedHdrSizeW</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061303"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-281"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061278"><span class="hs-identifier hs-var">offset_into_int</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Driver.Session.html#mAX_SPEC_SELECTEE_SIZE"><span class="hs-identifier hs-var">mAX_SPEC_SELECTEE_SIZE</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061303"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-comment">-- Offset is small enough</span><span>
</span><span id="line-282"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- NOT TRUE: ASSERT(is_single_constructor)</span><span>
</span><span id="line-283"></span><span>    </span><span class="hs-comment">-- The simplifier may have statically determined that the single alternative</span><span>
</span><span id="line-284"></span><span>    </span><span class="hs-comment">-- is the only possible case and eliminated the others, even if there are</span><span>
</span><span id="line-285"></span><span>    </span><span class="hs-comment">-- other constructors in the datatype.  It's still ok to make a selector</span><span>
</span><span id="line-286"></span><span>    </span><span class="hs-comment">-- thunk in this case, because we *know* which constructor the scrutinee</span><span>
</span><span id="line-287"></span><span>    </span><span class="hs-comment">-- will evaluate to.</span><span>
</span><span id="line-288"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-289"></span><span>    </span><span class="hs-comment">-- srt is discarded; it must be empty</span><span>
</span><span id="line-290"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061273"><span class="annot"><span class="annottext">lf_info :: LambdaFormInfo
</span><a href="#local-6989586621681061273"><span class="hs-identifier hs-var hs-var">lf_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; WordOff -&gt; Bool -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#mkSelectorLFInfo"><span class="hs-identifier hs-var">mkSelectorLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061302"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061278"><span class="hs-identifier hs-var">offset_into_int</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UpdateFlag -&gt; Bool
</span><a href="GHC.Stg.Syntax.html#isUpdatable"><span class="hs-identifier hs-var">isUpdatable</span></a></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061298"><span class="hs-identifier hs-var">upd_flag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-291"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Id
-&gt; LambdaFormInfo -&gt; [StgArg] -&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#cgRhsStdThunk"><span class="hs-identifier hs-var">cgRhsStdThunk</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061302"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061273"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; StgArg
</span><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-var">StgVarArg</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061299"><span class="hs-identifier hs-var">the_fv</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span class="hs-comment">---------- Note [Ap thunks] ------------------</span><span>
</span><span id="line-294"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#mkRhsClosure"><span class="hs-identifier hs-var">mkRhsClosure</span></a></span><span>    </span><span id="local-6989586621681061268"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061268"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681061267"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061267"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061266"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061266"><span class="hs-identifier hs-var">_cc</span></a></span></span><span>
</span><span id="line-295"></span><span>                </span><span id="local-6989586621681061265"><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061265"><span class="hs-identifier hs-var">fvs</span></a></span></span><span>
</span><span id="line-296"></span><span>                </span><span id="local-6989586621681061264"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061264"><span class="hs-identifier hs-var">upd_flag</span></a></span></span><span>
</span><span id="line-297"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                      </span><span class="hs-comment">-- No args; a thunk</span><span>
</span><span id="line-298"></span><span>                </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-type">StgApp</span></a></span><span> </span><span id="local-6989586621681061263"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061263"><span class="hs-identifier hs-var">fun_id</span></a></span></span><span> </span><span id="local-6989586621681061262"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061262"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-299"></span><span>
</span><span id="line-300"></span><span>  </span><span class="hs-comment">-- We are looking for an &quot;ApThunk&quot;; see data con ApThunk in GHC.StgToCmm.Closure</span><span>
</span><span id="line-301"></span><span>  </span><span class="hs-comment">-- of form (x1 x2 .... xn), where all the xi are locals (not top-level)</span><span>
</span><span id="line-302"></span><span>  </span><span class="hs-comment">-- So the xi will all be free variables</span><span>
</span><span id="line-303"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061262"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; WordOff -&gt; Bool
forall a. [a] -&gt; WordOff -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthIs"><span class="hs-operator hs-var">`lengthIs`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061260"><span class="hs-identifier hs-var">n_fvs</span></a></span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; WordOff
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- This happens only if the fun_id and</span><span>
</span><span id="line-304"></span><span>                               </span><span class="hs-comment">-- args are all distinct local variables</span><span>
</span><span id="line-305"></span><span>                               </span><span class="hs-comment">-- The &quot;-1&quot; is for fun_id</span><span>
</span><span id="line-306"></span><span>    </span><span class="hs-comment">-- Missed opportunity:   (f x x) is not detected</span><span>
</span><span id="line-307"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(NonVoid Id -&gt; Bool) -&gt; [NonVoid Id] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PrimRep -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isGcPtrRep"><span class="hs-identifier hs-var">isGcPtrRep</span></a></span><span> </span><span class="annot"><span class="annottext">(PrimRep -&gt; Bool) -&gt; (NonVoid Id -&gt; PrimRep) -&gt; NonVoid Id -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; PrimRep
</span><a href="GHC.StgToCmm.Closure.html#idPrimRep"><span class="hs-identifier hs-var">idPrimRep</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; PrimRep) -&gt; (NonVoid Id -&gt; Id) -&gt; NonVoid Id -&gt; PrimRep
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid Id -&gt; Id
forall a. NonVoid a -&gt; a
</span><a href="GHC.StgToCmm.Closure.html#fromNonVoid"><span class="hs-identifier hs-var">fromNonVoid</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061265"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">UpdateFlag -&gt; Bool
</span><a href="GHC.Stg.Syntax.html#isUpdatable"><span class="hs-identifier hs-var">isUpdatable</span></a></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061264"><span class="hs-identifier hs-var">upd_flag</span></a></span><span>
</span><span id="line-309"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061260"><span class="hs-identifier hs-var">n_fvs</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Driver.Session.html#mAX_SPEC_AP_SIZE"><span class="hs-identifier hs-var">mAX_SPEC_AP_SIZE</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061268"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#sccProfilingEnabled"><span class="hs-identifier hs-var">sccProfilingEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061268"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-311"></span><span>                         </span><span class="hs-comment">-- not when profiling: we don't want to</span><span>
</span><span id="line-312"></span><span>                         </span><span class="hs-comment">-- lose information about this particular</span><span>
</span><span id="line-313"></span><span>                         </span><span class="hs-comment">-- thunk (e.g. its type) (#949)</span><span>
</span><span id="line-314"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; WordOff
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061263"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="GHC.Types.Id.Info.html#unknownArity"><span class="hs-identifier hs-var">unknownArity</span></a></span><span> </span><span class="hs-comment">-- don't spoil a known call</span><span>
</span><span id="line-315"></span><span>
</span><span id="line-316"></span><span>          </span><span class="hs-comment">-- Ha! an Ap thunk</span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
-&gt; LambdaFormInfo -&gt; [StgArg] -&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#cgRhsStdThunk"><span class="hs-identifier hs-var">cgRhsStdThunk</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061267"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061251"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061250"><span class="hs-identifier hs-var">payload</span></a></span><span>
</span><span id="line-318"></span><span>
</span><span id="line-319"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-320"></span><span>    </span><span id="local-6989586621681061260"><span class="annot"><span class="annottext">n_fvs :: WordOff
</span><a href="#local-6989586621681061260"><span class="hs-identifier hs-var hs-var">n_fvs</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[NonVoid Id] -&gt; WordOff
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; WordOff
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061265"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-321"></span><span>    </span><span id="local-6989586621681061251"><span class="annot"><span class="annottext">lf_info :: LambdaFormInfo
</span><a href="#local-6989586621681061251"><span class="hs-identifier hs-var hs-var">lf_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; UpdateFlag -&gt; WordOff -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#mkApLFInfo"><span class="hs-identifier hs-var">mkApLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061267"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061264"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061260"><span class="hs-identifier hs-var">n_fvs</span></a></span><span>
</span><span id="line-322"></span><span>    </span><span class="hs-comment">-- the payload has to be in the correct order, hence we can't</span><span>
</span><span id="line-323"></span><span>    </span><span class="hs-comment">-- just use the fvs.</span><span>
</span><span id="line-324"></span><span>    </span><span id="local-6989586621681061250"><span class="annot"><span class="annottext">payload :: [StgArg]
</span><a href="#local-6989586621681061250"><span class="hs-identifier hs-var hs-var">payload</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; StgArg
</span><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-var">StgVarArg</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061263"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg -&gt; [StgArg] -&gt; [StgArg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061262"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span class="hs-comment">---------- Default case ------------------</span><span>
</span><span id="line-327"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#mkRhsClosure"><span class="hs-identifier hs-var">mkRhsClosure</span></a></span><span> </span><span id="local-6989586621681061246"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061246"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681061245"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061244"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061244"><span class="hs-identifier hs-var">cc</span></a></span></span><span> </span><span id="local-6989586621681061243"><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061243"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621681061242"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061242"><span class="hs-identifier hs-var">upd_flag</span></a></span></span><span> </span><span id="local-6989586621681061241"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061241"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681061240"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061240"><span class="hs-identifier hs-var">body</span></a></span></span><span>
</span><span id="line-328"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061239"><span class="annot"><span class="annottext">lf_info :: LambdaFormInfo
</span><a href="#local-6989586621681061239"><span class="hs-identifier hs-var hs-var">lf_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform
-&gt; Id
-&gt; TopLevelFlag
-&gt; [NonVoid Id]
-&gt; UpdateFlag
-&gt; [Id]
-&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Bind.html#mkClosureLFInfo"><span class="hs-identifier hs-var">mkClosureLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061238"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061243"><span class="hs-identifier hs-var">fvs</span></a></span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061242"><span class="hs-identifier hs-var">upd_flag</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061241"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-329"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681061236"><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061236"><span class="hs-identifier hs-var">id_info</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061235"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061235"><span class="hs-identifier hs-var">reg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; LambdaFormInfo -&gt; FCode (CgIdInfo, LocalReg)
</span><a href="GHC.StgToCmm.Env.html#rhsIdInfo"><span class="hs-identifier hs-var">rhsIdInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061239"><span class="hs-identifier hs-var">lf_info</span></a></span><span>
</span><span id="line-330"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(CgIdInfo, FCode CmmAGraph) -&gt; FCode (CgIdInfo, FCode CmmAGraph)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061236"><span class="hs-identifier hs-var">id_info</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo -&gt; LocalReg -&gt; FCode CmmAGraph
</span><a href="#local-6989586621681061233"><span class="hs-identifier hs-var">gen_code</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061239"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061235"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-331"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-332"></span><span> </span><span id="local-6989586621681061238"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681061238"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061246"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-333"></span><span> </span><span id="local-6989586621681061233"><span class="annot"><span class="annottext">gen_code :: LambdaFormInfo -&gt; LocalReg -&gt; FCode CmmAGraph
</span><a href="#local-6989586621681061233"><span class="hs-identifier hs-var hs-var">gen_code</span></a></span></span><span> </span><span id="local-6989586621681061227"><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061227"><span class="hs-identifier hs-var">lf_info</span></a></span></span><span> </span><span id="local-6989586621681061226"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061226"><span class="hs-identifier hs-var">reg</span></a></span></span><span>
</span><span id="line-334"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span>       </span><span class="hs-comment">-- LAY OUT THE OBJECT</span><span>
</span><span id="line-335"></span><span>        </span><span class="hs-comment">-- If the binder is itself a free variable, then don't store</span><span>
</span><span id="line-336"></span><span>        </span><span class="hs-comment">-- it in the closure.  Instead, just bind it to Node on entry.</span><span>
</span><span id="line-337"></span><span>        </span><span class="hs-comment">-- NB we can be sure that Node will point to it, because we</span><span>
</span><span id="line-338"></span><span>        </span><span class="hs-comment">-- haven't told mkClosureLFInfo about this; so if the binder</span><span>
</span><span id="line-339"></span><span>        </span><span class="hs-comment">-- _was_ a free var of its RHS, mkClosureLFInfo thinks it *is*</span><span>
</span><span id="line-340"></span><span>        </span><span class="hs-comment">-- stored in the closure itself, so it will make sure that</span><span>
</span><span id="line-341"></span><span>        </span><span class="hs-comment">-- Node points to it...</span><span>
</span><span id="line-342"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span>   </span><span id="local-6989586621681061223"><span class="annot"><span class="annottext">reduced_fvs :: [NonVoid Id]
</span><a href="#local-6989586621681061223"><span class="hs-identifier hs-var hs-var">reduced_fvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(NonVoid Id -&gt; Bool) -&gt; [NonVoid Id] -&gt; [NonVoid Id]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; NonVoid Id
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid Id -&gt; NonVoid Id -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061243"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-343"></span><span>
</span><span id="line-344"></span><span>        </span><span class="hs-comment">-- MAKE CLOSURE INFO FOR THIS CLOSURE</span><span>
</span><span id="line-345"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061221"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681061221"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Module
</span><a href="GHC.StgToCmm.Monad.html#getModuleName"><span class="hs-identifier hs-var">getModuleName</span></a></span><span>
</span><span id="line-346"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span>   </span><span id="local-6989586621681061220"><span class="annot"><span class="annottext">name :: Name
</span><a href="#local-6989586621681061220"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-347"></span><span>                </span><span id="local-6989586621681061219"><span class="annot"><span class="annottext">descr :: String
</span><a href="#local-6989586621681061219"><span class="hs-identifier hs-var hs-var">descr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Module -&gt; Name -&gt; String
</span><a href="GHC.StgToCmm.Bind.html#closureDescription"><span class="hs-identifier hs-var">closureDescription</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061246"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681061221"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681061220"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-348"></span><span>                </span><span class="annot"><a href="#local-6989586621681061218"><span class="hs-identifier hs-type">fv_details</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-349"></span><span>                </span><span id="local-6989586621681061217"><span class="annot"><span class="annottext">header :: ClosureHeader
</span><a href="#local-6989586621681061217"><span class="hs-identifier hs-var hs-var">header</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#isLFThunk"><span class="hs-identifier hs-var">isLFThunk</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061227"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#ThunkHeader"><span class="hs-identifier hs-var">ThunkHeader</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#StdHeader"><span class="hs-identifier hs-var">StdHeader</span></a></span><span>
</span><span id="line-350"></span><span>                </span><span class="hs-special">(</span><span id="local-6989586621681061216"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061216"><span class="hs-identifier hs-var">tot_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061215"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061215"><span class="hs-identifier hs-var">ptr_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061218"><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061218"><span class="hs-identifier hs-var">fv_details</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-351"></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, Id)]
-&gt; (WordOff, WordOff, [(NonVoid Id, WordOff)])
forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (WordOff, WordOff, [(NonVoid a, WordOff)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier hs-var">mkVirtHeapOffsets</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061246"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="#local-6989586621681061217"><span class="hs-identifier hs-var">header</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NonVoid Id] -&gt; [NonVoid (PrimRep, Id)]
</span><a href="GHC.StgToCmm.Closure.html#addIdReps"><span class="hs-identifier hs-var">addIdReps</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061223"><span class="hs-identifier hs-var">reduced_fvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-352"></span><span>                </span><span id="local-6989586621681061214"><span class="annot"><span class="annottext">closure_info :: ClosureInfo
</span><a href="#local-6989586621681061214"><span class="hs-identifier hs-var hs-var">closure_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Bool
-&gt; Id
-&gt; LambdaFormInfo
-&gt; WordOff
-&gt; WordOff
-&gt; String
-&gt; ClosureInfo
</span><a href="GHC.StgToCmm.Closure.html#mkClosureInfo"><span class="hs-identifier hs-var">mkClosureInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061246"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>       </span><span class="hs-comment">-- Not static</span><span>
</span><span id="line-353"></span><span>                                             </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061227"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061216"><span class="hs-identifier hs-var">tot_wds</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061215"><span class="hs-identifier hs-var">ptr_wds</span></a></span><span>
</span><span id="line-354"></span><span>                                             </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681061219"><span class="hs-identifier hs-var">descr</span></a></span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span>        </span><span class="hs-comment">-- BUILD ITS INFO TABLE AND CODE</span><span>
</span><span id="line-357"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#forkClosureBody"><span class="hs-identifier hs-var">forkClosureBody</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-358"></span><span>                </span><span class="hs-comment">-- forkClosureBody: (a) ensure that bindings in here are not seen elsewhere</span><span>
</span><span id="line-359"></span><span>                </span><span class="hs-comment">--                  (b) ignore Sequel from context; use empty Sequel</span><span>
</span><span id="line-360"></span><span>                </span><span class="hs-comment">-- And compile the body</span><span>
</span><span id="line-361"></span><span>                </span><span class="annot"><span class="annottext">Bool
-&gt; Id
-&gt; ClosureInfo
-&gt; CostCentreStack
-&gt; [Id]
-&gt; CgStgExpr
-&gt; [(NonVoid Id, WordOff)]
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#closureCodeBody"><span class="hs-identifier hs-var">closureCodeBody</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061214"><span class="hs-identifier hs-var">closure_info</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061244"><span class="hs-identifier hs-var">cc</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061241"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-362"></span><span>                                </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061240"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061218"><span class="hs-identifier hs-var">fv_details</span></a></span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span>        </span><span class="hs-comment">-- BUILD THE OBJECT</span><span>
</span><span id="line-365"></span><span class="hs-comment">--      ; (use_cc, blame_cc) &lt;- chooseDynCostCentres cc args body</span><span>
</span><span id="line-366"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061213"><span class="annot"><span class="annottext">use_cc :: CmmExpr
</span><a href="#local-6989586621681061213"><span class="hs-identifier hs-var hs-var">use_cc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="GHC.Cmm.Utils.html#cccsExpr"><span class="hs-identifier hs-var">cccsExpr</span></a></span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061211"><span class="annot"><span class="annottext">blame_cc :: CmmExpr
</span><a href="#local-6989586621681061211"><span class="hs-identifier hs-var hs-var">blame_cc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="GHC.Cmm.Utils.html#cccsExpr"><span class="hs-identifier hs-var">cccsExpr</span></a></span><span>
</span><span id="line-367"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkComment"><span class="hs-identifier hs-var">mkComment</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; CmmAGraph) -&gt; FastString -&gt; CmmAGraph
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;calling allocDynClosure&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-368"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061208"><span class="annot"><span class="annottext">toVarArg :: (NonVoid Id, b) -&gt; (NonVoid StgArg, b)
</span><a href="#local-6989586621681061208"><span class="hs-identifier hs-var hs-var">toVarArg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span id="local-6989586621681061207"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061207"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061206"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681061206"><span class="hs-identifier hs-var">off</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StgArg -&gt; NonVoid StgArg
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; StgArg
</span><a href="GHC.Stg.Syntax.html#StgVarArg"><span class="hs-identifier hs-var">StgVarArg</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061207"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681061206"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-369"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061205"><span class="annot"><span class="annottext">info_tbl :: CmmInfoTable
</span><a href="#local-6989586621681061205"><span class="hs-identifier hs-var hs-var">info_tbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; Id -&gt; CostCentreStack -&gt; CmmInfoTable
</span><a href="GHC.StgToCmm.Closure.html#mkCmmInfo"><span class="hs-identifier hs-var">mkCmmInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061214"><span class="hs-identifier hs-var">closure_info</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#currentCCS"><span class="hs-identifier hs-var">currentCCS</span></a></span><span>
</span><span id="line-370"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061202"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061202"><span class="hs-identifier hs-var">hp_plus_n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Id
-&gt; CmmInfoTable
-&gt; LambdaFormInfo
-&gt; CmmExpr
-&gt; CmmExpr
-&gt; [(NonVoid StgArg, WordOff)]
-&gt; FCode CmmExpr
</span><a href="GHC.StgToCmm.Heap.html#allocDynClosure"><span class="hs-identifier hs-var">allocDynClosure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Maybe Id
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061245"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681061205"><span class="hs-identifier hs-var">info_tbl</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061227"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061213"><span class="hs-identifier hs-var">use_cc</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061211"><span class="hs-identifier hs-var">blame_cc</span></a></span><span>
</span><span id="line-371"></span><span>                                         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((NonVoid Id, WordOff) -&gt; (NonVoid StgArg, WordOff))
-&gt; [(NonVoid Id, WordOff)] -&gt; [(NonVoid StgArg, WordOff)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(NonVoid Id, WordOff) -&gt; (NonVoid StgArg, WordOff)
forall {b}. (NonVoid Id, b) -&gt; (NonVoid StgArg, b)
</span><a href="#local-6989586621681061208"><span class="hs-identifier hs-var">toVarArg</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061218"><span class="hs-identifier hs-var">fv_details</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span>        </span><span class="hs-comment">-- RETURN</span><span>
</span><span id="line-374"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode CmmAGraph
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; LocalReg -&gt; LambdaFormInfo -&gt; CmmExpr -&gt; CmmAGraph
</span><a href="GHC.StgToCmm.Env.html#mkRhsInit"><span class="hs-identifier hs-var">mkRhsInit</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061246"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061226"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061227"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061202"><span class="hs-identifier hs-var">hp_plus_n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-375"></span><span>
</span><span id="line-376"></span><span class="hs-comment">-------------------------</span><span>
</span><span id="line-377"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#cgRhsStdThunk"><span class="hs-identifier hs-type">cgRhsStdThunk</span></a></span><span>
</span><span id="line-378"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-379"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#LambdaFormInfo"><span class="hs-identifier hs-type">LambdaFormInfo</span></a></span><span>
</span><span id="line-380"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgArg"><span class="hs-identifier hs-type">StgArg</span></a></span><span class="hs-special">]</span><span>             </span><span class="hs-comment">-- payload</span><span>
</span><span id="line-381"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Monad.html#CgIdInfo"><span class="hs-identifier hs-type">CgIdInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Graph.html#CmmAGraph"><span class="hs-identifier hs-type">CmmAGraph</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-382"></span><span>
</span><span id="line-383"></span><span id="cgRhsStdThunk"><span class="annot"><span class="annottext">cgRhsStdThunk :: Id
-&gt; LambdaFormInfo -&gt; [StgArg] -&gt; FCode (CgIdInfo, FCode CmmAGraph)
</span><a href="GHC.StgToCmm.Bind.html#cgRhsStdThunk"><span class="hs-identifier hs-var hs-var">cgRhsStdThunk</span></a></span></span><span> </span><span id="local-6989586621681061199"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061199"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061198"><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061198"><span class="hs-identifier hs-var">lf_info</span></a></span></span><span> </span><span id="local-6989586621681061197"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061197"><span class="hs-identifier hs-var">payload</span></a></span></span><span>
</span><span id="line-384"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681061196"><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061196"><span class="hs-identifier hs-var">id_info</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061195"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061195"><span class="hs-identifier hs-var">reg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; LambdaFormInfo -&gt; FCode (CgIdInfo, LocalReg)
</span><a href="GHC.StgToCmm.Env.html#rhsIdInfo"><span class="hs-identifier hs-var">rhsIdInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061199"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061198"><span class="hs-identifier hs-var">lf_info</span></a></span><span>
</span><span id="line-385"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(CgIdInfo, FCode CmmAGraph) -&gt; FCode (CgIdInfo, FCode CmmAGraph)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CgIdInfo
</span><a href="#local-6989586621681061196"><span class="hs-identifier hs-var">id_info</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; FCode CmmAGraph
</span><a href="#local-6989586621681061194"><span class="hs-identifier hs-var">gen_code</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061195"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-386"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-387"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-388"></span><span> </span><span id="local-6989586621681061194"><span class="annot"><span class="annottext">gen_code :: LocalReg -&gt; FCode CmmAGraph
</span><a href="#local-6989586621681061194"><span class="hs-identifier hs-var hs-var">gen_code</span></a></span></span><span> </span><span id="local-6989586621681061188"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061188"><span class="hs-identifier hs-var">reg</span></a></span></span><span>  </span><span class="hs-comment">-- AHA!  A STANDARD-FORM THUNK</span><span>
</span><span id="line-389"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Name -&gt; FCode CmmAGraph -&gt; FCode CmmAGraph
forall a. Bool -&gt; Name -&gt; FCode a -&gt; FCode a
</span><a href="GHC.StgToCmm.Ticky.html#withNewTickyCounterStdThunk"><span class="hs-identifier hs-var">withNewTickyCounterStdThunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#lfUpdatable"><span class="hs-identifier hs-var">lfUpdatable</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061198"><span class="hs-identifier hs-var">lf_info</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061199"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(FCode CmmAGraph -&gt; FCode CmmAGraph)
-&gt; FCode CmmAGraph -&gt; FCode CmmAGraph
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-390"></span><span>    </span><span class="hs-keyword">do</span><span>
</span><span id="line-391"></span><span>  </span><span class="hs-special">{</span><span>     </span><span class="hs-comment">-- LAY OUT THE OBJECT</span><span>
</span><span id="line-392"></span><span>    </span><span id="local-6989586621681061185"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681061185"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Module
</span><a href="GHC.StgToCmm.Monad.html#getModuleName"><span class="hs-identifier hs-var">getModuleName</span></a></span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061184"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061184"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-394"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061183"><span class="annot"><span class="annottext">header :: ClosureHeader
</span><a href="#local-6989586621681061183"><span class="hs-identifier hs-var hs-var">header</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#isLFThunk"><span class="hs-identifier hs-var">isLFThunk</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061198"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#ThunkHeader"><span class="hs-identifier hs-var">ThunkHeader</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#StdHeader"><span class="hs-identifier hs-var">StdHeader</span></a></span><span>
</span><span id="line-395"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681061182"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061182"><span class="hs-identifier hs-var">tot_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061181"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061181"><span class="hs-identifier hs-var">ptr_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061180"><span class="annot"><span class="annottext">[(NonVoid StgArg, WordOff)]
</span><a href="#local-6989586621681061180"><span class="hs-identifier hs-var">payload_w_offsets</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, StgArg)]
-&gt; (WordOff, WordOff, [(NonVoid StgArg, WordOff)])
forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (WordOff, WordOff, [(NonVoid a, WordOff)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier hs-var">mkVirtHeapOffsets</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061184"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="#local-6989586621681061183"><span class="hs-identifier hs-var">header</span></a></span><span>
</span><span id="line-397"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NonVoid StgArg] -&gt; [NonVoid (PrimRep, StgArg)]
</span><a href="GHC.StgToCmm.Closure.html#addArgReps"><span class="hs-identifier hs-var">addArgReps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[StgArg] -&gt; [NonVoid StgArg]
</span><a href="GHC.StgToCmm.Closure.html#nonVoidStgArgs"><span class="hs-identifier hs-var">nonVoidStgArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681061197"><span class="hs-identifier hs-var">payload</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>
</span><span id="line-399"></span><span>        </span><span id="local-6989586621681061177"><span class="annot"><span class="annottext">descr :: String
</span><a href="#local-6989586621681061177"><span class="hs-identifier hs-var hs-var">descr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Module -&gt; Name -&gt; String
</span><a href="GHC.StgToCmm.Bind.html#closureDescription"><span class="hs-identifier hs-var">closureDescription</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061184"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681061185"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061199"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-400"></span><span>        </span><span id="local-6989586621681061176"><span class="annot"><span class="annottext">closure_info :: ClosureInfo
</span><a href="#local-6989586621681061176"><span class="hs-identifier hs-var hs-var">closure_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Bool
-&gt; Id
-&gt; LambdaFormInfo
-&gt; WordOff
-&gt; WordOff
-&gt; String
-&gt; ClosureInfo
</span><a href="GHC.StgToCmm.Closure.html#mkClosureInfo"><span class="hs-identifier hs-var">mkClosureInfo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061184"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>       </span><span class="hs-comment">-- Not static</span><span>
</span><span id="line-401"></span><span>                                     </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061199"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061198"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061182"><span class="hs-identifier hs-var">tot_wds</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061181"><span class="hs-identifier hs-var">ptr_wds</span></a></span><span>
</span><span id="line-402"></span><span>                                     </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681061177"><span class="hs-identifier hs-var">descr</span></a></span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="hs-comment">--  ; (use_cc, blame_cc) &lt;- chooseDynCostCentres cc [{- no args-}] body</span><span>
</span><span id="line-405"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061175"><span class="annot"><span class="annottext">use_cc :: CmmExpr
</span><a href="#local-6989586621681061175"><span class="hs-identifier hs-var hs-var">use_cc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="GHC.Cmm.Utils.html#cccsExpr"><span class="hs-identifier hs-var">cccsExpr</span></a></span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061174"><span class="annot"><span class="annottext">blame_cc :: CmmExpr
</span><a href="#local-6989586621681061174"><span class="hs-identifier hs-var hs-var">blame_cc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="GHC.Cmm.Utils.html#cccsExpr"><span class="hs-identifier hs-var">cccsExpr</span></a></span><span>
</span><span id="line-406"></span><span>
</span><span id="line-407"></span><span>
</span><span id="line-408"></span><span>        </span><span class="hs-comment">-- BUILD THE OBJECT</span><span>
</span><span id="line-409"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061173"><span class="annot"><span class="annottext">info_tbl :: CmmInfoTable
</span><a href="#local-6989586621681061173"><span class="hs-identifier hs-var hs-var">info_tbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; Id -&gt; CostCentreStack -&gt; CmmInfoTable
</span><a href="GHC.StgToCmm.Closure.html#mkCmmInfo"><span class="hs-identifier hs-var">mkCmmInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061176"><span class="hs-identifier hs-var">closure_info</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061199"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="GHC.Types.CostCentre.html#currentCCS"><span class="hs-identifier hs-var">currentCCS</span></a></span><span>
</span><span id="line-410"></span><span>  </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061172"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061172"><span class="hs-identifier hs-var">hp_plus_n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Id
-&gt; CmmInfoTable
-&gt; LambdaFormInfo
-&gt; CmmExpr
-&gt; CmmExpr
-&gt; [(NonVoid StgArg, WordOff)]
-&gt; FCode CmmExpr
</span><a href="GHC.StgToCmm.Heap.html#allocDynClosure"><span class="hs-identifier hs-var">allocDynClosure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Maybe Id
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061199"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681061173"><span class="hs-identifier hs-var">info_tbl</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061198"><span class="hs-identifier hs-var">lf_info</span></a></span><span>
</span><span id="line-411"></span><span>                                   </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061175"><span class="hs-identifier hs-var">use_cc</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061174"><span class="hs-identifier hs-var">blame_cc</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid StgArg, WordOff)]
</span><a href="#local-6989586621681061180"><span class="hs-identifier hs-var">payload_w_offsets</span></a></span><span>
</span><span id="line-412"></span><span>
</span><span id="line-413"></span><span>        </span><span class="hs-comment">-- RETURN</span><span>
</span><span id="line-414"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode CmmAGraph
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; LocalReg -&gt; LambdaFormInfo -&gt; CmmExpr -&gt; CmmAGraph
</span><a href="GHC.StgToCmm.Env.html#mkRhsInit"><span class="hs-identifier hs-var">mkRhsInit</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061184"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061188"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061198"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061172"><span class="hs-identifier hs-var">hp_plus_n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span>
</span><span id="line-417"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#mkClosureLFInfo"><span class="hs-identifier hs-type">mkClosureLFInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span>
</span><span id="line-418"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>           </span><span class="hs-comment">-- The binder</span><span>
</span><span id="line-419"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span> </span><span class="hs-comment">-- True of top level</span><span>
</span><span id="line-420"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- Free vars</span><span>
</span><span id="line-421"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#UpdateFlag"><span class="hs-identifier hs-type">UpdateFlag</span></a></span><span>   </span><span class="hs-comment">-- Update flag</span><span>
</span><span id="line-422"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>         </span><span class="hs-comment">-- Args</span><span>
</span><span id="line-423"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#LambdaFormInfo"><span class="hs-identifier hs-type">LambdaFormInfo</span></a></span><span>
</span><span id="line-424"></span><span id="mkClosureLFInfo"><span class="annot"><span class="annottext">mkClosureLFInfo :: Platform
-&gt; Id
-&gt; TopLevelFlag
-&gt; [NonVoid Id]
-&gt; UpdateFlag
-&gt; [Id]
-&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Bind.html#mkClosureLFInfo"><span class="hs-identifier hs-var hs-var">mkClosureLFInfo</span></a></span></span><span> </span><span id="local-6989586621681061171"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061171"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span id="local-6989586621681061170"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061170"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061169"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681061169"><span class="hs-identifier hs-var">top</span></a></span></span><span> </span><span id="local-6989586621681061168"><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061168"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621681061167"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061167"><span class="hs-identifier hs-var">upd_flag</span></a></span></span><span> </span><span id="local-6989586621681061166"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061166"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-425"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061166"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-426"></span><span>        </span><span class="annot"><span class="annottext">Type -&gt; TopLevelFlag -&gt; [Id] -&gt; UpdateFlag -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#mkLFThunk"><span class="hs-identifier hs-var">mkLFThunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061170"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681061169"><span class="hs-identifier hs-var">top</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(NonVoid Id -&gt; Id) -&gt; [NonVoid Id] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid Id -&gt; Id
forall a. NonVoid a -&gt; a
</span><a href="GHC.StgToCmm.Closure.html#fromNonVoid"><span class="hs-identifier hs-var">fromNonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061168"><span class="hs-identifier hs-var">fvs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621681061167"><span class="hs-identifier hs-var">upd_flag</span></a></span><span>
</span><span id="line-427"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-428"></span><span>        </span><span class="annot"><span class="annottext">TopLevelFlag -&gt; [Id] -&gt; [Id] -&gt; ArgDescr -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#mkLFReEntrant"><span class="hs-identifier hs-var">mkLFReEntrant</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681061169"><span class="hs-identifier hs-var">top</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(NonVoid Id -&gt; Id) -&gt; [NonVoid Id] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid Id -&gt; Id
forall a. NonVoid a -&gt; a
</span><a href="GHC.StgToCmm.Closure.html#fromNonVoid"><span class="hs-identifier hs-var">fromNonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061168"><span class="hs-identifier hs-var">fvs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061166"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; [Id] -&gt; ArgDescr
</span><a href="GHC.StgToCmm.Layout.html#mkArgDescr"><span class="hs-identifier hs-var">mkArgDescr</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061171"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061166"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-432"></span><span class="hs-comment">--              The code for closures</span><span>
</span><span id="line-433"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-434"></span><span>
</span><span id="line-435"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#closureCodeBody"><span class="hs-identifier hs-type">closureCodeBody</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>            </span><span class="hs-comment">-- whether this is a top-level binding</span><span>
</span><span id="line-436"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>              </span><span class="hs-comment">-- the closure's name</span><span>
</span><span id="line-437"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html#ClosureInfo"><span class="hs-identifier hs-type">ClosureInfo</span></a></span><span>     </span><span class="hs-comment">-- Lots of information about this closure</span><span>
</span><span id="line-438"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CostCentreStack"><span class="hs-identifier hs-type">CostCentreStack</span></a></span><span> </span><span class="hs-comment">-- Optional cost centre attached to closure</span><span>
</span><span id="line-439"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>            </span><span class="hs-comment">-- incoming args to the closure</span><span>
</span><span id="line-440"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgExpr"><span class="hs-identifier hs-type">CgStgExpr</span></a></span><span>
</span><span id="line-441"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- the closure's free vars</span><span>
</span><span id="line-442"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-443"></span><span>
</span><span id="line-444"></span><span class="hs-comment">{- There are two main cases for the code for closures.

* If there are *no arguments*, then the closure is a thunk, and not in
  normal form. So it should set up an update frame (if it is
  shared). NB: Thunks cannot have a primitive type!

* If there is *at least one* argument, then this closure is in
  normal form, so there is no need to set up an update frame.
-}</span><span>
</span><span id="line-453"></span><span>
</span><span id="line-454"></span><span class="hs-comment">-- No args i.e. thunk</span><span>
</span><span id="line-455"></span><span id="closureCodeBody"><span class="annot"><span class="annottext">closureCodeBody :: Bool
-&gt; Id
-&gt; ClosureInfo
-&gt; CostCentreStack
-&gt; [Id]
-&gt; CgStgExpr
-&gt; [(NonVoid Id, WordOff)]
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#closureCodeBody"><span class="hs-identifier hs-var hs-var">closureCodeBody</span></a></span></span><span> </span><span id="local-6989586621681061161"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061161"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681061160"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061160"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061159"><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061159"><span class="hs-identifier hs-var">cl_info</span></a></span></span><span> </span><span id="local-6989586621681061158"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061158"><span class="hs-identifier hs-var">cc</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621681061157"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061157"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span id="local-6989586621681061156"><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061156"><span class="hs-identifier hs-var">fv_details</span></a></span></span><span>
</span><span id="line-456"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Name -&gt; FCode () -&gt; FCode ()
forall a. Bool -&gt; Bool -&gt; Name -&gt; FCode a -&gt; FCode a
</span><a href="GHC.StgToCmm.Ticky.html#withNewTickyCounterThunk"><span class="hs-identifier hs-var">withNewTickyCounterThunk</span></a></span><span>
</span><span id="line-457"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#isStaticClosure"><span class="hs-identifier hs-var">isStaticClosure</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061159"><span class="hs-identifier hs-var">cl_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-458"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#closureUpdReqd"><span class="hs-identifier hs-var">closureUpdReqd</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061159"><span class="hs-identifier hs-var">cl_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-459"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; Name
</span><a href="GHC.StgToCmm.Closure.html#closureName"><span class="hs-identifier hs-var hs-var">closureName</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061159"><span class="hs-identifier hs-var">cl_info</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-460"></span><span>    </span><span class="annot"><span class="annottext">Bool
-&gt; Id
-&gt; LambdaFormInfo
-&gt; CmmInfoTable
-&gt; [NonVoid Id]
-&gt; ((WordOff, LocalReg, [LocalReg]) -&gt; FCode ())
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Layout.html#emitClosureProcAndInfoTable"><span class="hs-identifier hs-var">emitClosureProcAndInfoTable</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061161"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061160"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061150"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681061149"><span class="hs-identifier hs-var">info_tbl</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(((WordOff, LocalReg, [LocalReg]) -&gt; FCode ()) -&gt; FCode ())
-&gt; ((WordOff, LocalReg, [LocalReg]) -&gt; FCode ()) -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-461"></span><span>      </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061148"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061148"><span class="hs-identifier hs-var">node</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ClosureInfo
-&gt; [(NonVoid Id, WordOff)]
-&gt; CostCentreStack
-&gt; LocalReg
-&gt; CgStgExpr
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#thunkCode"><span class="hs-identifier hs-var">thunkCode</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061159"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061156"><span class="hs-identifier hs-var">fv_details</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061158"><span class="hs-identifier hs-var">cc</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061148"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061157"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-462"></span><span>   </span><span class="hs-keyword">where</span><span>
</span><span id="line-463"></span><span>     </span><span id="local-6989586621681061150"><span class="annot"><span class="annottext">lf_info :: LambdaFormInfo
</span><a href="#local-6989586621681061150"><span class="hs-identifier hs-var hs-var">lf_info</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#closureLFInfo"><span class="hs-identifier hs-var hs-var">closureLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061159"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-464"></span><span>     </span><span id="local-6989586621681061149"><span class="annot"><span class="annottext">info_tbl :: CmmInfoTable
</span><a href="#local-6989586621681061149"><span class="hs-identifier hs-var hs-var">info_tbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; Id -&gt; CostCentreStack -&gt; CmmInfoTable
</span><a href="GHC.StgToCmm.Closure.html#mkCmmInfo"><span class="hs-identifier hs-var">mkCmmInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061159"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061160"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061158"><span class="hs-identifier hs-var">cc</span></a></span><span>
</span><span id="line-465"></span><span>
</span><span id="line-466"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#closureCodeBody"><span class="hs-identifier hs-var">closureCodeBody</span></a></span><span> </span><span id="local-6989586621681061145"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061145"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681061144"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061144"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061143"><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span></span><span> </span><span id="local-6989586621681061142"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061142"><span class="hs-identifier hs-var">cc</span></a></span></span><span> </span><span id="local-6989586621681061141"><span class="annot"><span class="annottext">args :: [Id]
</span><a href="#local-6989586621681061141"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621681061140"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061140"><span class="hs-identifier hs-var">arg0</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[Id]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681061139"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061139"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span id="local-6989586621681061138"><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061138"><span class="hs-identifier hs-var">fv_details</span></a></span></span><span>
</span><span id="line-467"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061137"><span class="annot"><span class="annottext">nv_args :: [NonVoid Id]
</span><a href="#local-6989586621681061137"><span class="hs-identifier hs-var hs-var">nv_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [NonVoid Id]
</span><a href="GHC.StgToCmm.Closure.html#nonVoidIds"><span class="hs-identifier hs-var">nonVoidIds</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061141"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-468"></span><span>        </span><span id="local-6989586621681061135"><span class="annot"><span class="annottext">arity :: WordOff
</span><a href="#local-6989586621681061135"><span class="hs-identifier hs-var hs-var">arity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; WordOff
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; WordOff
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681061141"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-469"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-470"></span><span>    </span><span class="hs-comment">-- See Note [OneShotInfo overview] in GHC.Types.Basic.</span><span>
</span><span id="line-471"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Name -&gt; [NonVoid Id] -&gt; FCode () -&gt; FCode ()
forall a. Bool -&gt; Name -&gt; [NonVoid Id] -&gt; FCode a -&gt; FCode a
</span><a href="GHC.StgToCmm.Ticky.html#withNewTickyCounterFun"><span class="hs-identifier hs-var">withNewTickyCounterFun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Bool
</span><a href="GHC.Types.Id.html#isOneShotBndr"><span class="hs-identifier hs-var">isOneShotBndr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061140"><span class="hs-identifier hs-var">arg0</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; Name
</span><a href="GHC.StgToCmm.Closure.html#closureName"><span class="hs-identifier hs-var hs-var">closureName</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-472"></span><span>        </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061137"><span class="hs-identifier hs-var">nv_args</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-473"></span><span>
</span><span id="line-474"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-475"></span><span>             </span><span id="local-6989586621681061132"><span class="annot"><span class="annottext">lf_info :: LambdaFormInfo
</span><a href="#local-6989586621681061132"><span class="hs-identifier hs-var hs-var">lf_info</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#closureLFInfo"><span class="hs-identifier hs-var hs-var">closureLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-476"></span><span>             </span><span id="local-6989586621681061131"><span class="annot"><span class="annottext">info_tbl :: CmmInfoTable
</span><a href="#local-6989586621681061131"><span class="hs-identifier hs-var hs-var">info_tbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; Id -&gt; CostCentreStack -&gt; CmmInfoTable
</span><a href="GHC.StgToCmm.Closure.html#mkCmmInfo"><span class="hs-identifier hs-var">mkCmmInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061144"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061142"><span class="hs-identifier hs-var">cc</span></a></span><span>
</span><span id="line-477"></span><span>
</span><span id="line-478"></span><span>        </span><span class="hs-comment">-- Emit the main entry code</span><span>
</span><span id="line-479"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Id
-&gt; LambdaFormInfo
-&gt; CmmInfoTable
-&gt; [NonVoid Id]
-&gt; ((WordOff, LocalReg, [LocalReg]) -&gt; FCode ())
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Layout.html#emitClosureProcAndInfoTable"><span class="hs-identifier hs-var">emitClosureProcAndInfoTable</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061145"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061144"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061132"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681061131"><span class="hs-identifier hs-var">info_tbl</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681061137"><span class="hs-identifier hs-var">nv_args</span></a></span><span> </span><span class="annot"><span class="annottext">(((WordOff, LocalReg, [LocalReg]) -&gt; FCode ()) -&gt; FCode ())
-&gt; ((WordOff, LocalReg, [LocalReg]) -&gt; FCode ()) -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-480"></span><span>            </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621681061130"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061130"><span class="hs-identifier hs-var">_offset</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061129"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061129"><span class="hs-identifier hs-var">node</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061128"><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681061128"><span class="hs-identifier hs-var">arg_regs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-481"></span><span>                </span><span class="hs-comment">-- Emit slow-entry code (for entering a closure through a PAP)</span><span>
</span><span id="line-482"></span><span>                </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Id -&gt; ClosureInfo -&gt; [LocalReg] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#mkSlowEntryCode"><span class="hs-identifier hs-var">mkSlowEntryCode</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061144"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681061128"><span class="hs-identifier hs-var">arg_regs</span></a></span><span>
</span><span id="line-483"></span><span>                </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061126"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061126"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-484"></span><span>                </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061125"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061125"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-485"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061123"><span class="annot"><span class="annottext">node_points :: Bool
</span><a href="#local-6989586621681061123"><span class="hs-identifier hs-var hs-var">node_points</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#nodeMustPointToIt"><span class="hs-identifier hs-var">nodeMustPointToIt</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061126"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061132"><span class="hs-identifier hs-var">lf_info</span></a></span><span>
</span><span id="line-486"></span><span>                      </span><span id="local-6989586621681061121"><span class="annot"><span class="annottext">node' :: Maybe LocalReg
</span><a href="#local-6989586621681061121"><span class="hs-identifier hs-var hs-var">node'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061123"><span class="hs-identifier hs-var">node_points</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; Maybe LocalReg
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061129"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Maybe LocalReg
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-487"></span><span>                </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061120"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681061120"><span class="hs-identifier hs-var">loop_header_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode BlockId
forall (m :: * -&gt; *). MonadUnique m =&gt; m BlockId
</span><a href="GHC.Cmm.BlockId.html#newBlockId"><span class="hs-identifier hs-var">newBlockId</span></a></span><span>
</span><span id="line-488"></span><span>                </span><span class="hs-comment">-- Extend reader monad with information that</span><span>
</span><span id="line-489"></span><span>                </span><span class="hs-comment">-- self-recursive tail calls can be optimized into local</span><span>
</span><span id="line-490"></span><span>                </span><span class="hs-comment">-- jumps. See Note [Self-recursive tail calls] in GHC.StgToCmm.Expr.</span><span>
</span><span id="line-491"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">SelfLoopInfo -&gt; FCode () -&gt; FCode ()
forall a. SelfLoopInfo -&gt; FCode a -&gt; FCode a
</span><a href="GHC.StgToCmm.Monad.html#withSelfLoop"><span class="hs-identifier hs-var">withSelfLoop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061144"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681061120"><span class="hs-identifier hs-var">loop_header_id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681061128"><span class="hs-identifier hs-var">arg_regs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-492"></span><span>                </span><span class="hs-special">{</span><span>
</span><span id="line-493"></span><span>                </span><span class="hs-comment">-- Main payload</span><span>
</span><span id="line-494"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClosureInfo
-&gt; Maybe LocalReg -&gt; WordOff -&gt; [LocalReg] -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Heap.html#entryHeapCheck"><span class="hs-identifier hs-var">entryHeapCheck</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LocalReg
</span><a href="#local-6989586621681061121"><span class="hs-identifier hs-var">node'</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061135"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681061128"><span class="hs-identifier hs-var">arg_regs</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-495"></span><span>                </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- emit LDV code when profiling</span><span>
</span><span id="line-496"></span><span>                  </span><span class="annot"><span class="annottext">Bool -&gt; FCode () -&gt; FCode ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061123"><span class="hs-identifier hs-var">node_points</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; CmmReg -&gt; FCode ()
</span><a href="GHC.StgToCmm.Prof.html#ldvEnterClosure"><span class="hs-identifier hs-var">ldvEnterClosure</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061129"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-497"></span><span>                </span><span class="hs-comment">-- ticky after heap check to avoid double counting</span><span>
</span><span id="line-498"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyEnterFun"><span class="hs-identifier hs-var">tickyEnterFun</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-499"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CostCentreStack -&gt; CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Prof.html#enterCostCentreFun"><span class="hs-identifier hs-var">enterCostCentreFun</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061142"><span class="hs-identifier hs-var">cc</span></a></span><span>
</span><span id="line-500"></span><span>                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MachOp -&gt; [CmmExpr] -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmMachOp"><span class="hs-identifier hs-var">CmmMachOp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; MachOp
</span><a href="GHC.Cmm.MachOp.html#mo_wordSub"><span class="hs-identifier hs-var">mo_wordSub</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061125"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-501"></span><span>                         </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061129"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- See [NodeReg clobbered with loopification]</span><span>
</span><span id="line-502"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; WordOff -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#mkIntExpr"><span class="hs-identifier hs-var">mkIntExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061125"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; ClosureInfo -&gt; WordOff
</span><a href="GHC.StgToCmm.Closure.html#funTag"><span class="hs-identifier hs-var">funTag</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061126"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061143"><span class="hs-identifier hs-var">cl_info</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span>                </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061108"><span class="annot"><span class="annottext">[(LocalReg, WordOff)]
</span><a href="#local-6989586621681061108"><span class="hs-identifier hs-var">fv_bindings</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((NonVoid Id, WordOff) -&gt; FCode (LocalReg, WordOff))
-&gt; [(NonVoid Id, WordOff)] -&gt; FCode [(LocalReg, WordOff)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">(NonVoid Id, WordOff) -&gt; FCode (LocalReg, WordOff)
</span><a href="GHC.StgToCmm.Bind.html#bind_fv"><span class="hs-identifier hs-var">bind_fv</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061138"><span class="hs-identifier hs-var">fv_details</span></a></span><span>
</span><span id="line-504"></span><span>                </span><span class="hs-comment">-- Load free vars out of closure *after*</span><span>
</span><span id="line-505"></span><span>                </span><span class="hs-comment">-- heap check, to reduce live vars over check</span><span>
</span><span id="line-506"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; FCode () -&gt; FCode ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061123"><span class="hs-identifier hs-var">node_points</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; LambdaFormInfo -&gt; [(LocalReg, WordOff)] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#load_fvs"><span class="hs-identifier hs-var">load_fvs</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061129"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061132"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">[(LocalReg, WordOff)]
</span><a href="#local-6989586621681061108"><span class="hs-identifier hs-var">fv_bindings</span></a></span><span>
</span><span id="line-507"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode ReturnKind -&gt; FCode ()
forall (f :: * -&gt; *) a. Functor f =&gt; f a -&gt; f ()
</span><a href="../../base/src/Data.Functor.html#void"><span class="hs-identifier hs-var">void</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode ReturnKind -&gt; FCode ()) -&gt; FCode ReturnKind -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Expr.html#cgExpr"><span class="hs-identifier hs-var">cgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061139"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-508"></span><span>                </span><span class="hs-special">}</span><span class="hs-special">}</span><span class="hs-special">}</span><span>
</span><span id="line-509"></span><span>
</span><span id="line-510"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span class="hs-comment">-- Note [NodeReg clobbered with loopification]</span><span>
</span><span id="line-513"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-514"></span><span class="hs-comment">--</span><span>
</span><span id="line-515"></span><span class="hs-comment">-- Previously we used to pass nodeReg (aka R1) here. With profiling, upon</span><span>
</span><span id="line-516"></span><span class="hs-comment">-- entering a closure, enterFunCCS was called with R1 passed to it. But since R1</span><span>
</span><span id="line-517"></span><span class="hs-comment">-- may get clobbered inside the body of a closure, and since a self-recursive</span><span>
</span><span id="line-518"></span><span class="hs-comment">-- tail call does not restore R1, a subsequent call to enterFunCCS received a</span><span>
</span><span id="line-519"></span><span class="hs-comment">-- possibly bogus value from R1. The solution is to not pass nodeReg (aka R1) to</span><span>
</span><span id="line-520"></span><span class="hs-comment">-- enterFunCCS. Instead, we pass node, the callee-saved temporary that stores</span><span>
</span><span id="line-521"></span><span class="hs-comment">-- the original value of R1. This way R1 may get modified but loopification will</span><span>
</span><span id="line-522"></span><span class="hs-comment">-- not care.</span><span>
</span><span id="line-523"></span><span>
</span><span id="line-524"></span><span class="hs-comment">-- A function closure pointer may be tagged, so we</span><span>
</span><span id="line-525"></span><span class="hs-comment">-- must take it into account when accessing the free variables.</span><span>
</span><span id="line-526"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#bind_fv"><span class="hs-identifier hs-type">bind_fv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-527"></span><span id="bind_fv"><span class="annot"><span class="annottext">bind_fv :: (NonVoid Id, WordOff) -&gt; FCode (LocalReg, WordOff)
</span><a href="GHC.StgToCmm.Bind.html#bind_fv"><span class="hs-identifier hs-var hs-var">bind_fv</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681061102"><span class="annot"><span class="annottext">NonVoid Id
</span><a href="#local-6989586621681061102"><span class="hs-identifier hs-var">id</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061101"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061101"><span class="hs-identifier hs-var">off</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681061100"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061100"><span class="hs-identifier hs-var">reg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">NonVoid Id -&gt; FCode LocalReg
</span><a href="GHC.StgToCmm.Env.html#rebindToReg"><span class="hs-identifier hs-var">rebindToReg</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid Id
</span><a href="#local-6989586621681061102"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LocalReg, WordOff) -&gt; FCode (LocalReg, WordOff)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061100"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061101"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-528"></span><span>
</span><span id="line-529"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#load_fvs"><span class="hs-identifier hs-type">load_fvs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#LambdaFormInfo"><span class="hs-identifier hs-type">LambdaFormInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-530"></span><span id="load_fvs"><span class="annot"><span class="annottext">load_fvs :: LocalReg -&gt; LambdaFormInfo -&gt; [(LocalReg, WordOff)] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#load_fvs"><span class="hs-identifier hs-var hs-var">load_fvs</span></a></span></span><span> </span><span id="local-6989586621681061098"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061098"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span id="local-6989586621681061097"><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061097"><span class="hs-identifier hs-var">lf_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((LocalReg, WordOff) -&gt; FCode ())
-&gt; [(LocalReg, WordOff)] -&gt; FCode ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681061095"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061095"><span class="hs-identifier hs-var">reg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681061094"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061094"><span class="hs-identifier hs-var">off</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-531"></span><span>   </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681061093"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061093"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-532"></span><span>      </span><span id="local-6989586621681061092"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061092"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-533"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061091"><span class="annot"><span class="annottext">tag :: WordOff
</span><a href="#local-6989586621681061091"><span class="hs-identifier hs-var hs-var">tag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; LambdaFormInfo -&gt; WordOff
</span><a href="GHC.StgToCmm.Closure.html#lfDynTag"><span class="hs-identifier hs-var">lfDynTag</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061093"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061097"><span class="hs-identifier hs-var">lf_info</span></a></span><span>
</span><span id="line-534"></span><span>      </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmAGraph -&gt; FCode ()) -&gt; CmmAGraph -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; LocalReg -&gt; LocalReg -&gt; WordOff -&gt; WordOff -&gt; CmmAGraph
</span><a href="GHC.StgToCmm.Utils.html#mkTaggedObjectLoad"><span class="hs-identifier hs-var">mkTaggedObjectLoad</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061092"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061095"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061098"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061094"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061091"><span class="hs-identifier hs-var">tag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-535"></span><span>
</span><span id="line-536"></span><span class="hs-comment">-----------------------------------------</span><span>
</span><span id="line-537"></span><span class="hs-comment">-- The &quot;slow entry&quot; code for a function.  This entry point takes its</span><span>
</span><span id="line-538"></span><span class="hs-comment">-- arguments on the stack.  It loads the arguments into registers</span><span>
</span><span id="line-539"></span><span class="hs-comment">-- according to the calling convention, and jumps to the function's</span><span>
</span><span id="line-540"></span><span class="hs-comment">-- normal entry point.  The function's closure is assumed to be in</span><span>
</span><span id="line-541"></span><span class="hs-comment">-- R1/node.</span><span>
</span><span id="line-542"></span><span class="hs-comment">--</span><span>
</span><span id="line-543"></span><span class="hs-comment">-- The slow entry point is used for unknown calls: eg. stg_PAP_entry</span><span>
</span><span id="line-544"></span><span>
</span><span id="line-545"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#mkSlowEntryCode"><span class="hs-identifier hs-type">mkSlowEntryCode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html#ClosureInfo"><span class="hs-identifier hs-type">ClosureInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-546"></span><span class="hs-comment">-- If this function doesn't have a specialised ArgDescr, we need</span><span>
</span><span id="line-547"></span><span class="hs-comment">-- to generate the function's arg bitmap and slow-entry code.</span><span>
</span><span id="line-548"></span><span class="hs-comment">-- Here, we emit the slow-entry code.</span><span>
</span><span id="line-549"></span><span id="mkSlowEntryCode"><span class="annot"><span class="annottext">mkSlowEntryCode :: Id -&gt; ClosureInfo -&gt; [LocalReg] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#mkSlowEntryCode"><span class="hs-identifier hs-var hs-var">mkSlowEntryCode</span></a></span></span><span> </span><span id="local-6989586621681061088"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061088"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681061087"><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061087"><span class="hs-identifier hs-var">cl_info</span></a></span></span><span> </span><span id="local-6989586621681061086"><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681061086"><span class="hs-identifier hs-var">arg_regs</span></a></span></span><span> </span><span class="hs-comment">-- function closure is already in `Node'</span><span>
</span><span id="line-550"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#ArgGen"><span class="hs-identifier hs-type">ArgGen</span></a></span><span> </span><span class="annot"><span class="annottext">Liveness
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; Maybe (WordOff, ArgDescr)
</span><a href="GHC.StgToCmm.Closure.html#closureFunInfo"><span class="hs-identifier hs-var">closureFunInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061087"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-551"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681061083"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061083"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-552"></span><span>       </span><span id="local-6989586621681061082"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061082"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-553"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061081"><span class="annot"><span class="annottext">node :: LocalReg
</span><a href="#local-6989586621681061081"><span class="hs-identifier hs-var hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; NonVoid Id -&gt; LocalReg
</span><a href="GHC.StgToCmm.Env.html#idToReg"><span class="hs-identifier hs-var">idToReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061082"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; NonVoid Id
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681061088"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-554"></span><span>           </span><span id="local-6989586621681061079"><span class="annot"><span class="annottext">slow_lbl :: CLabel
</span><a href="#local-6989586621681061079"><span class="hs-identifier hs-var hs-var">slow_lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; CLabel
</span><a href="GHC.StgToCmm.Closure.html#closureSlowEntryLabel"><span class="hs-identifier hs-var">closureSlowEntryLabel</span></a></span><span>  </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061087"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-555"></span><span>           </span><span id="local-6989586621681061077"><span class="annot"><span class="annottext">fast_lbl :: CLabel
</span><a href="#local-6989586621681061077"><span class="hs-identifier hs-var hs-var">fast_lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; ClosureInfo -&gt; CLabel
</span><a href="GHC.StgToCmm.Closure.html#closureLocalEntryLabel"><span class="hs-identifier hs-var">closureLocalEntryLabel</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061082"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061087"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-556"></span><span>           </span><span class="hs-comment">-- mkDirectJump does not clobber `Node' containing function closure</span><span>
</span><span id="line-557"></span><span>           </span><span id="local-6989586621681061075"><span class="annot"><span class="annottext">jump :: CmmAGraph
</span><a href="#local-6989586621681061075"><span class="hs-identifier hs-var hs-var">jump</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Convention -&gt; CmmExpr -&gt; [CmmExpr] -&gt; WordOff -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkJump"><span class="hs-identifier hs-var">mkJump</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061083"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeNodeCall"><span class="hs-identifier hs-var">NativeNodeCall</span></a></span><span>
</span><span id="line-558"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabel -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#mkLblExpr"><span class="hs-identifier hs-var">mkLblExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061077"><span class="hs-identifier hs-var">fast_lbl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-559"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LocalReg -&gt; CmmExpr) -&gt; [LocalReg] -&gt; [CmmExpr]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmReg -&gt; CmmExpr) -&gt; (LocalReg -&gt; CmmReg) -&gt; LocalReg -&gt; CmmExpr
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061081"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; [LocalReg] -&gt; [LocalReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681061086"><span class="hs-identifier hs-var">arg_regs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-560"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; WordOff
</span><a href="GHC.StgToCmm.Monad.html#initUpdFrameOff"><span class="hs-identifier hs-var">initUpdFrameOff</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061082"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-561"></span><span>       </span><span id="local-6989586621681061070"><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681061070"><span class="hs-identifier hs-var">tscope</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode CmmTickScope
</span><a href="GHC.StgToCmm.Monad.html#getTickScope"><span class="hs-identifier hs-var">getTickScope</span></a></span><span>
</span><span id="line-562"></span><span>       </span><span class="annot"><span class="annottext">Convention
-&gt; Maybe CmmInfoTable
-&gt; CLabel
-&gt; [LocalReg]
-&gt; CmmAGraphScoped
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitProcWithConvention"><span class="hs-identifier hs-var">emitProcWithConvention</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#Slow"><span class="hs-identifier hs-var">Slow</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe CmmInfoTable
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061079"><span class="hs-identifier hs-var">slow_lbl</span></a></span><span>
</span><span id="line-563"></span><span>         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061081"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; [LocalReg] -&gt; [LocalReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681061086"><span class="hs-identifier hs-var">arg_regs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681061075"><span class="hs-identifier hs-var">jump</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681061070"><span class="hs-identifier hs-var">tscope</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-564"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; FCode ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-565"></span><span>
</span><span id="line-566"></span><span class="hs-comment">-----------------------------------------</span><span>
</span><span id="line-567"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#thunkCode"><span class="hs-identifier hs-type">thunkCode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html#ClosureInfo"><span class="hs-identifier hs-type">ClosureInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CostCentreStack"><span class="hs-identifier hs-type">CostCentreStack</span></a></span><span>
</span><span id="line-568"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#CgStgExpr"><span class="hs-identifier hs-type">CgStgExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-569"></span><span id="thunkCode"><span class="annot"><span class="annottext">thunkCode :: ClosureInfo
-&gt; [(NonVoid Id, WordOff)]
-&gt; CostCentreStack
-&gt; LocalReg
-&gt; CgStgExpr
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#thunkCode"><span class="hs-identifier hs-var hs-var">thunkCode</span></a></span></span><span> </span><span id="local-6989586621681061066"><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span></span><span> </span><span id="local-6989586621681061065"><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061065"><span class="hs-identifier hs-var">fv_details</span></a></span></span><span> </span><span id="local-6989586621681061064"><span class="annot"><span class="annottext">CostCentreStack
</span><a href="#local-6989586621681061064"><span class="hs-identifier hs-var">_cc</span></a></span></span><span> </span><span id="local-6989586621681061063"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061063"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span id="local-6989586621681061062"><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061062"><span class="hs-identifier hs-var">body</span></a></span></span><span>
</span><span id="line-570"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681061061"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061061"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-571"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061060"><span class="annot"><span class="annottext">node_points :: Bool
</span><a href="#local-6989586621681061060"><span class="hs-identifier hs-var hs-var">node_points</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#nodeMustPointToIt"><span class="hs-identifier hs-var">nodeMustPointToIt</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061061"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#closureLFInfo"><span class="hs-identifier hs-var hs-var">closureLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-572"></span><span>             </span><span id="local-6989586621681061059"><span class="annot"><span class="annottext">node' :: Maybe LocalReg
</span><a href="#local-6989586621681061059"><span class="hs-identifier hs-var hs-var">node'</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061060"><span class="hs-identifier hs-var">node_points</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; Maybe LocalReg
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061063"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Maybe LocalReg
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-573"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; CmmReg -&gt; FCode ()
</span><a href="GHC.StgToCmm.Prof.html#ldvEnterClosure"><span class="hs-identifier hs-var">ldvEnterClosure</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061063"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- NB: Node always points when profiling</span><span>
</span><span id="line-574"></span><span>
</span><span id="line-575"></span><span>        </span><span class="hs-comment">-- Heap overflow check</span><span>
</span><span id="line-576"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClosureInfo
-&gt; Maybe LocalReg -&gt; WordOff -&gt; [LocalReg] -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Heap.html#entryHeapCheck"><span class="hs-identifier hs-var">entryHeapCheck</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LocalReg
</span><a href="#local-6989586621681061059"><span class="hs-identifier hs-var">node'</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-577"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- Overwrite with black hole if necessary</span><span>
</span><span id="line-578"></span><span>          </span><span class="hs-comment">-- but *after* the heap-overflow check</span><span>
</span><span id="line-579"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyEnterThunk"><span class="hs-identifier hs-var">tickyEnterThunk</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-580"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; FCode () -&gt; FCode ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#blackHoleOnEntry"><span class="hs-identifier hs-var">blackHoleOnEntry</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061060"><span class="hs-identifier hs-var">node_points</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-581"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#blackHoleIt"><span class="hs-identifier hs-var">blackHoleIt</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061063"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-582"></span><span>
</span><span id="line-583"></span><span>          </span><span class="hs-comment">-- Push update frame</span><span>
</span><span id="line-584"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; LocalReg -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#setupUpdate"><span class="hs-identifier hs-var">setupUpdate</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061063"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-585"></span><span>            </span><span class="hs-comment">-- We only enter cc after setting up update so</span><span>
</span><span id="line-586"></span><span>            </span><span class="hs-comment">-- that cc of enclosing scope will be recorded</span><span>
</span><span id="line-587"></span><span>            </span><span class="hs-comment">-- in update frame CAF/DICT functions will be</span><span>
</span><span id="line-588"></span><span>            </span><span class="hs-comment">-- subsumed by this enclosing cc</span><span>
</span><span id="line-589"></span><span>            </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Prof.html#enterCostCentreThunk"><span class="hs-identifier hs-var">enterCostCentreThunk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">CmmReg
</span><a href="GHC.Cmm.Expr.html#nodeReg"><span class="hs-identifier hs-var">nodeReg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-590"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061052"><span class="annot"><span class="annottext">lf_info :: LambdaFormInfo
</span><a href="#local-6989586621681061052"><span class="hs-identifier hs-var hs-var">lf_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#closureLFInfo"><span class="hs-identifier hs-var hs-var">closureLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061066"><span class="hs-identifier hs-var">cl_info</span></a></span><span>
</span><span id="line-591"></span><span>               </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681061051"><span class="annot"><span class="annottext">[(LocalReg, WordOff)]
</span><a href="#local-6989586621681061051"><span class="hs-identifier hs-var">fv_bindings</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((NonVoid Id, WordOff) -&gt; FCode (LocalReg, WordOff))
-&gt; [(NonVoid Id, WordOff)] -&gt; FCode [(LocalReg, WordOff)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">(NonVoid Id, WordOff) -&gt; FCode (LocalReg, WordOff)
</span><a href="GHC.StgToCmm.Bind.html#bind_fv"><span class="hs-identifier hs-var">bind_fv</span></a></span><span> </span><span class="annot"><span class="annottext">[(NonVoid Id, WordOff)]
</span><a href="#local-6989586621681061065"><span class="hs-identifier hs-var">fv_details</span></a></span><span>
</span><span id="line-592"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; LambdaFormInfo -&gt; [(LocalReg, WordOff)] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#load_fvs"><span class="hs-identifier hs-var">load_fvs</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061063"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681061052"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="annot"><span class="annottext">[(LocalReg, WordOff)]
</span><a href="#local-6989586621681061051"><span class="hs-identifier hs-var">fv_bindings</span></a></span><span>
</span><span id="line-593"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode ReturnKind -&gt; FCode ()
forall (f :: * -&gt; *) a. Functor f =&gt; f a -&gt; f ()
</span><a href="../../base/src/Data.Functor.html#void"><span class="hs-identifier hs-var">void</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode ReturnKind -&gt; FCode ()) -&gt; FCode ReturnKind -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Expr.html#cgExpr"><span class="hs-identifier hs-var">cgExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CgStgExpr
</span><a href="#local-6989586621681061062"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">}</span><span class="hs-special">}</span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-597"></span><span class="hs-comment">--              Update and black-hole wrappers</span><span>
</span><span id="line-598"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-599"></span><span>
</span><span id="line-600"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#blackHoleIt"><span class="hs-identifier hs-type">blackHoleIt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-601"></span><span class="hs-comment">-- Only called for closures with no args</span><span>
</span><span id="line-602"></span><span class="hs-comment">-- Node points to the closure</span><span>
</span><span id="line-603"></span><span id="blackHoleIt"><span class="annot"><span class="annottext">blackHoleIt :: LocalReg -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#blackHoleIt"><span class="hs-identifier hs-var hs-var">blackHoleIt</span></a></span></span><span> </span><span id="local-6989586621681061050"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061050"><span class="hs-identifier hs-var">node_reg</span></a></span></span><span>
</span><span id="line-604"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#emitBlackHoleCode"><span class="hs-identifier hs-var">emitBlackHoleCode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061050"><span class="hs-identifier hs-var">node_reg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-605"></span><span>
</span><span id="line-606"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#emitBlackHoleCode"><span class="hs-identifier hs-type">emitBlackHoleCode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-607"></span><span id="emitBlackHoleCode"><span class="annot"><span class="annottext">emitBlackHoleCode :: CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#emitBlackHoleCode"><span class="hs-identifier hs-var hs-var">emitBlackHoleCode</span></a></span></span><span> </span><span id="local-6989586621681061049"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061049"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-608"></span><span>  </span><span id="local-6989586621681061048"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061048"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-609"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681061047"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681061047"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061048"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-610"></span><span>
</span><span id="line-611"></span><span>  </span><span class="hs-comment">-- Eager blackholing is normally disabled, but can be turned on with</span><span>
</span><span id="line-612"></span><span>  </span><span class="hs-comment">-- -feager-blackholing.  When it is on, we replace the info pointer</span><span>
</span><span id="line-613"></span><span>  </span><span class="hs-comment">-- of the thunk with stg_EAGER_BLACKHOLE_info on entry.</span><span>
</span><span id="line-614"></span><span>
</span><span id="line-615"></span><span>  </span><span class="hs-comment">-- If we wanted to do eager blackholing with slop filling, we'd need</span><span>
</span><span id="line-616"></span><span>  </span><span class="hs-comment">-- to do it at the *end* of a basic block, otherwise we overwrite</span><span>
</span><span id="line-617"></span><span>  </span><span class="hs-comment">-- the free variables in the thunk that we still need.  We have a</span><span>
</span><span id="line-618"></span><span>  </span><span class="hs-comment">-- patch for this from Andy Cheadle, but not incorporated yet. --SDM</span><span>
</span><span id="line-619"></span><span>  </span><span class="hs-comment">-- [6/2004]</span><span>
</span><span id="line-620"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-621"></span><span>  </span><span class="hs-comment">-- Previously, eager blackholing was enabled when ticky-ticky was</span><span>
</span><span id="line-622"></span><span>  </span><span class="hs-comment">-- on. But it didn't work, and it wasn't strictly necessary to bring</span><span>
</span><span id="line-623"></span><span>  </span><span class="hs-comment">-- back minimal ticky-ticky, so now EAGER_BLACKHOLING is</span><span>
</span><span id="line-624"></span><span>  </span><span class="hs-comment">-- unconditionally disabled. -- krc 1/2007</span><span>
</span><span id="line-625"></span><span>
</span><span id="line-626"></span><span>  </span><span class="hs-comment">-- Note the eager-blackholing check is here rather than in blackHoleOnEntry,</span><span>
</span><span id="line-627"></span><span>  </span><span class="hs-comment">-- because emitBlackHoleCode is called from GHC.Cmm.Parser.</span><span>
</span><span id="line-628"></span><span>
</span><span id="line-629"></span><span>  </span><span class="hs-keyword">let</span><span>  </span><span id="local-6989586621681061046"><span class="annot"><span class="annottext">eager_blackholing :: Bool
</span><a href="#local-6989586621681061046"><span class="hs-identifier hs-var hs-var">eager_blackholing</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#sccProfilingEnabled"><span class="hs-identifier hs-var">sccProfilingEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061048"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-630"></span><span>                         </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_EagerBlackHoling"><span class="hs-identifier hs-var">Opt_EagerBlackHoling</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061048"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-631"></span><span>             </span><span class="hs-comment">-- Profiling needs slop filling (to support LDV</span><span>
</span><span id="line-632"></span><span>             </span><span class="hs-comment">-- profiling), so currently eager blackholing doesn't</span><span>
</span><span id="line-633"></span><span>             </span><span class="hs-comment">-- work with profiling.</span><span>
</span><span id="line-634"></span><span>
</span><span id="line-635"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; FCode () -&gt; FCode ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061046"><span class="hs-identifier hs-var">eager_blackholing</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-636"></span><span>    </span><span class="annot"><span class="annottext">FCode () -&gt; FCode ()
forall a. FCode a -&gt; FCode ()
</span><a href="GHC.StgToCmm.Utils.html#whenUpdRemSetEnabled"><span class="hs-identifier hs-var">whenUpdRemSetEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Utils.html#emitUpdRemSetPushThunk"><span class="hs-identifier hs-var">emitUpdRemSetPushThunk</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061049"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-637"></span><span>    </span><span class="annot"><span class="annottext">CmmExpr -&gt; CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitStore"><span class="hs-identifier hs-var">emitStore</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; WordOff -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmOffsetW"><span class="hs-identifier hs-var">cmmOffsetW</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681061047"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061049"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Runtime.Heap.Layout.html#fixedHdrSizeW"><span class="hs-identifier hs-var">fixedHdrSizeW</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061048"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="GHC.Cmm.Utils.html#currentTSOExpr"><span class="hs-identifier hs-var">currentTSOExpr</span></a></span><span>
</span><span id="line-638"></span><span>    </span><span class="hs-comment">-- See Note [Heap memory barriers] in SMP.h.</span><span>
</span><span id="line-639"></span><span>    </span><span class="annot"><span class="annottext">[LocalReg] -&gt; CallishMachOp -&gt; [CmmExpr] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Foreign.html#emitPrimCall"><span class="hs-identifier hs-var">emitPrimCall</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">CallishMachOp
</span><a href="GHC.Cmm.MachOp.html#MO_WriteBarrier"><span class="hs-identifier hs-var">MO_WriteBarrier</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-640"></span><span>    </span><span class="annot"><span class="annottext">CmmExpr -&gt; CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitStore"><span class="hs-identifier hs-var">emitStore</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061049"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmGlobal"><span class="hs-identifier hs-var">CmmGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="GHC.Cmm.Expr.html#EagerBlackholeInfo"><span class="hs-identifier hs-var">EagerBlackholeInfo</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-641"></span><span>
</span><span id="line-642"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#setupUpdate"><span class="hs-identifier hs-type">setupUpdate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html#ClosureInfo"><span class="hs-identifier hs-type">ClosureInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-643"></span><span>        </span><span class="hs-comment">-- Nota Bene: this function does not change Node (even if it's a CAF),</span><span>
</span><span id="line-644"></span><span>        </span><span class="hs-comment">-- so that the cost centre in the original closure can still be</span><span>
</span><span id="line-645"></span><span>        </span><span class="hs-comment">-- extracted by a subsequent enterCostCentre</span><span>
</span><span id="line-646"></span><span id="setupUpdate"><span class="annot"><span class="annottext">setupUpdate :: ClosureInfo -&gt; LocalReg -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#setupUpdate"><span class="hs-identifier hs-var hs-var">setupUpdate</span></a></span></span><span> </span><span id="local-6989586621681061035"><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061035"><span class="hs-identifier hs-var">closure_info</span></a></span></span><span> </span><span id="local-6989586621681061034"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061034"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span id="local-6989586621681061033"><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061033"><span class="hs-identifier hs-var">body</span></a></span></span><span>
</span><span id="line-647"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#lfUpdatable"><span class="hs-identifier hs-var">lfUpdatable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; LambdaFormInfo
</span><a href="GHC.StgToCmm.Closure.html#closureLFInfo"><span class="hs-identifier hs-var hs-var">closureLFInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061035"><span class="hs-identifier hs-var">closure_info</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-648"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061033"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-649"></span><span>
</span><span id="line-650"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#isStaticClosure"><span class="hs-identifier hs-var">isStaticClosure</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061035"><span class="hs-identifier hs-var">closure_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-651"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClosureInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#closureUpdReqd"><span class="hs-identifier hs-var">closureUpdReqd</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061035"><span class="hs-identifier hs-var">closure_info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-652"></span><span>      </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyUpdateFrameOmitted"><span class="hs-identifier hs-var">tickyUpdateFrameOmitted</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061033"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-653"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-654"></span><span>          </span><span class="annot"><span class="annottext">FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyPushUpdateFrame"><span class="hs-identifier hs-var">tickyPushUpdateFrame</span></a></span><span>
</span><span id="line-655"></span><span>          </span><span id="local-6989586621681061030"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061030"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-656"></span><span>          </span><span class="hs-keyword">let</span><span>
</span><span id="line-657"></span><span>              </span><span id="local-6989586621681061029"><span class="annot"><span class="annottext">bh :: Bool
</span><a href="#local-6989586621681061029"><span class="hs-identifier hs-var hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#blackHoleOnEntry"><span class="hs-identifier hs-var">blackHoleOnEntry</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061035"><span class="hs-identifier hs-var">closure_info</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-658"></span><span>                   </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#sccProfilingEnabled"><span class="hs-identifier hs-var">sccProfilingEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061030"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-659"></span><span>                   </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_EagerBlackHoling"><span class="hs-identifier hs-var">Opt_EagerBlackHoling</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061030"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span>              </span><span id="local-6989586621681061028"><span class="annot"><span class="annottext">lbl :: CLabel
</span><a href="#local-6989586621681061028"><span class="hs-identifier hs-var hs-var">lbl</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681061029"><span class="hs-identifier hs-var">bh</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="GHC.Cmm.CLabel.html#mkBHUpdInfoLabel"><span class="hs-identifier hs-var">mkBHUpdInfoLabel</span></a></span><span>
</span><span id="line-662"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="GHC.Cmm.CLabel.html#mkUpdInfoLabel"><span class="hs-identifier hs-var">mkUpdInfoLabel</span></a></span><span>
</span><span id="line-663"></span><span>
</span><span id="line-664"></span><span>          </span><span class="annot"><span class="annottext">CLabel -&gt; CmmExpr -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#pushUpdateFrame"><span class="hs-identifier hs-var">pushUpdateFrame</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061028"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061034"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061033"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-665"></span><span>
</span><span id="line-666"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-comment">-- A static closure</span><span>
</span><span id="line-667"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyUpdateBhCaf"><span class="hs-identifier hs-var">tickyUpdateBhCaf</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061035"><span class="hs-identifier hs-var">closure_info</span></a></span><span>
</span><span id="line-668"></span><span>
</span><span id="line-669"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">ClosureInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#closureUpdReqd"><span class="hs-identifier hs-var">closureUpdReqd</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureInfo
</span><a href="#local-6989586621681061035"><span class="hs-identifier hs-var">closure_info</span></a></span><span>
</span><span id="line-670"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>       </span><span class="hs-comment">-- Blackhole the (updatable) CAF:</span><span>
</span><span id="line-671"></span><span>                </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681061024"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061024"><span class="hs-identifier hs-var">upd_closure</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; FCode CmmExpr
</span><a href="GHC.StgToCmm.Bind.html#link_caf"><span class="hs-identifier hs-var">link_caf</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681061034"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-672"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CLabel -&gt; CmmExpr -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#pushUpdateFrame"><span class="hs-identifier hs-var">pushUpdateFrame</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="GHC.Cmm.CLabel.html#mkBHUpdInfoLabel"><span class="hs-identifier hs-var">mkBHUpdInfoLabel</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061024"><span class="hs-identifier hs-var">upd_closure</span></a></span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061033"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-673"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyUpdateFrameOmitted"><span class="hs-identifier hs-var">tickyUpdateFrameOmitted</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061033"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-674"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-675"></span><span>
</span><span id="line-676"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-677"></span><span class="hs-comment">-- Setting up update frames</span><span>
</span><span id="line-678"></span><span>
</span><span id="line-679"></span><span class="hs-comment">-- Push the update frame on the stack in the Entry area,</span><span>
</span><span id="line-680"></span><span class="hs-comment">-- leaving room for the return address that is already</span><span>
</span><span id="line-681"></span><span class="hs-comment">-- at the old end of the area.</span><span>
</span><span id="line-682"></span><span class="hs-comment">--</span><span>
</span><span id="line-683"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#pushUpdateFrame"><span class="hs-identifier hs-type">pushUpdateFrame</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html#CLabel"><span class="hs-identifier hs-type">CLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-684"></span><span id="pushUpdateFrame"><span class="annot"><span class="annottext">pushUpdateFrame :: CLabel -&gt; CmmExpr -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#pushUpdateFrame"><span class="hs-identifier hs-var hs-var">pushUpdateFrame</span></a></span></span><span> </span><span id="local-6989586621681061022"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061022"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681061021"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061021"><span class="hs-identifier hs-var">updatee</span></a></span></span><span> </span><span id="local-6989586621681061020"><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061020"><span class="hs-identifier hs-var">body</span></a></span></span><span>
</span><span id="line-685"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-686"></span><span>       </span><span id="local-6989586621681061019"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061019"><span class="hs-identifier hs-var">updfr</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode WordOff
</span><a href="GHC.StgToCmm.Monad.html#getUpdFrameOff"><span class="hs-identifier hs-var">getUpdFrameOff</span></a></span><span>
</span><span id="line-687"></span><span>       </span><span id="local-6989586621681061017"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061017"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-688"></span><span>       </span><span class="hs-keyword">let</span><span>
</span><span id="line-689"></span><span>           </span><span id="local-6989586621681061016"><span class="annot"><span class="annottext">hdr :: WordOff
</span><a href="#local-6989586621681061016"><span class="hs-identifier hs-var hs-var">hdr</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Runtime.Heap.Layout.html#fixedHdrSize"><span class="hs-identifier hs-var">fixedHdrSize</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061017"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-690"></span><span>           </span><span id="local-6989586621681061012"><span class="annot"><span class="annottext">frame :: WordOff
</span><a href="#local-6989586621681061012"><span class="hs-identifier hs-var hs-var">frame</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061019"><span class="hs-identifier hs-var">updfr</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; WordOff
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061016"><span class="hs-identifier hs-var">hdr</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; WordOff
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Driver.Session.html#sIZEOF_StgUpdateFrame_NoHdr"><span class="hs-identifier hs-var">sIZEOF_StgUpdateFrame_NoHdr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061017"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-691"></span><span>       </span><span class="hs-comment">--</span><span>
</span><span id="line-692"></span><span>       </span><span class="annot"><span class="annottext">DynFlags -&gt; CmmExpr -&gt; CLabel -&gt; CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#emitUpdateFrame"><span class="hs-identifier hs-var">emitUpdateFrame</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061017"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Area -&gt; WordOff -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmStackSlot"><span class="hs-identifier hs-var">CmmStackSlot</span></a></span><span> </span><span class="annot"><span class="annottext">Area
</span><a href="GHC.Cmm.Expr.html#Old"><span class="hs-identifier hs-var">Old</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061012"><span class="hs-identifier hs-var">frame</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061022"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061021"><span class="hs-identifier hs-var">updatee</span></a></span><span>
</span><span id="line-693"></span><span>       </span><span class="annot"><span class="annottext">WordOff -&gt; FCode () -&gt; FCode ()
forall a. WordOff -&gt; FCode a -&gt; FCode a
</span><a href="GHC.StgToCmm.Monad.html#withUpdFrameOff"><span class="hs-identifier hs-var">withUpdFrameOff</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061012"><span class="hs-identifier hs-var">frame</span></a></span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681061020"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-694"></span><span>
</span><span id="line-695"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#emitUpdateFrame"><span class="hs-identifier hs-type">emitUpdateFrame</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html#CLabel"><span class="hs-identifier hs-type">CLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-696"></span><span id="emitUpdateFrame"><span class="annot"><span class="annottext">emitUpdateFrame :: DynFlags -&gt; CmmExpr -&gt; CLabel -&gt; CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Bind.html#emitUpdateFrame"><span class="hs-identifier hs-var hs-var">emitUpdateFrame</span></a></span></span><span> </span><span id="local-6989586621681061006"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061006"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681061005"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061005"><span class="hs-identifier hs-var">frame</span></a></span></span><span> </span><span id="local-6989586621681061004"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061004"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681061003"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061003"><span class="hs-identifier hs-var">updatee</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-697"></span><span>  </span><span class="hs-keyword">let</span><span>
</span><span id="line-698"></span><span>           </span><span id="local-6989586621681061002"><span class="annot"><span class="annottext">hdr :: WordOff
</span><a href="#local-6989586621681061002"><span class="hs-identifier hs-var hs-var">hdr</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Runtime.Heap.Layout.html#fixedHdrSize"><span class="hs-identifier hs-var">fixedHdrSize</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061006"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-699"></span><span>           </span><span id="local-6989586621681061000"><span class="annot"><span class="annottext">off_updatee :: WordOff
</span><a href="#local-6989586621681061000"><span class="hs-identifier hs-var hs-var">off_updatee</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061002"><span class="hs-identifier hs-var">hdr</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff -&gt; WordOff -&gt; WordOff
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; WordOff
</span><a href="GHC.Driver.Session.html#oFFSET_StgUpdateFrame_updatee"><span class="hs-identifier hs-var">oFFSET_StgUpdateFrame_updatee</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061006"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-700"></span><span>           </span><span id="local-6989586621681060998"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681060998"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681061006"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-701"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-702"></span><span>  </span><span class="annot"><span class="annottext">CmmExpr -&gt; CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitStore"><span class="hs-identifier hs-var">emitStore</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061005"><span class="hs-identifier hs-var">frame</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabel -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#mkLblExpr"><span class="hs-identifier hs-var">mkLblExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681061004"><span class="hs-identifier hs-var">lbl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-703"></span><span>  </span><span class="annot"><span class="annottext">CmmExpr -&gt; CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitStore"><span class="hs-identifier hs-var">emitStore</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; WordOff -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmOffset"><span class="hs-identifier hs-var">cmmOffset</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681060998"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061005"><span class="hs-identifier hs-var">frame</span></a></span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681061000"><span class="hs-identifier hs-var">off_updatee</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061003"><span class="hs-identifier hs-var">updatee</span></a></span><span>
</span><span id="line-704"></span><span>  </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode ()
</span><a href="GHC.StgToCmm.Prof.html#initUpdFrameProf"><span class="hs-identifier hs-var">initUpdFrameProf</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681061005"><span class="hs-identifier hs-var">frame</span></a></span><span>
</span><span id="line-705"></span><span>
</span><span id="line-706"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-707"></span><span class="hs-comment">-- Entering a CAF</span><span>
</span><span id="line-708"></span><span class="hs-comment">--</span><span>
</span><span id="line-709"></span><span class="hs-comment">-- See Note [CAF management] in rts/sm/Storage.c</span><span>
</span><span id="line-710"></span><span>
</span><span id="line-711"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#link_caf"><span class="hs-identifier hs-type">link_caf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span>           </span><span class="hs-comment">-- pointer to the closure</span><span>
</span><span id="line-712"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span>      </span><span class="hs-comment">-- Returns amode for closure to be updated</span><span>
</span><span id="line-713"></span><span class="hs-comment">-- This function returns the address of the black hole, so it can be</span><span>
</span><span id="line-714"></span><span class="hs-comment">-- updated with the new value when available.</span><span>
</span><span id="line-715"></span><span id="link_caf"><span class="annot"><span class="annottext">link_caf :: LocalReg -&gt; FCode CmmExpr
</span><a href="GHC.StgToCmm.Bind.html#link_caf"><span class="hs-identifier hs-var hs-var">link_caf</span></a></span></span><span> </span><span id="local-6989586621681060996"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681060996"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-716"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681060995"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681060995"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-717"></span><span>        </span><span class="hs-comment">-- Call the RTS function newCAF, returning the newly-allocated</span><span>
</span><span id="line-718"></span><span>        </span><span class="hs-comment">-- blackhole indirection closure</span><span>
</span><span id="line-719"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681060994"><span class="annot"><span class="annottext">newCAF_lbl :: CLabel
</span><a href="#local-6989586621681060994"><span class="hs-identifier hs-var hs-var">newCAF_lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString
-&gt; Maybe WordOff -&gt; ForeignLabelSource -&gt; FunctionOrData -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkForeignLabel"><span class="hs-identifier hs-var">mkForeignLabel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newCAF&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe WordOff
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-720"></span><span>                                    </span><span class="annot"><span class="annottext">ForeignLabelSource
</span><a href="GHC.Cmm.CLabel.html#ForeignLabelInExternalPackage"><span class="hs-identifier hs-var">ForeignLabelInExternalPackage</span></a></span><span> </span><span class="annot"><span class="annottext">FunctionOrData
</span><a href="GHC.Types.Basic.html#IsFunction"><span class="hs-identifier hs-var">IsFunction</span></a></span><span>
</span><span id="line-721"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681060989"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681060989"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681060995"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-722"></span><span>  </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681060988"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681060988"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CmmType -&gt; FCode LocalReg
forall (m :: * -&gt; *). MonadUnique m =&gt; CmmType -&gt; m LocalReg
</span><a href="GHC.StgToCmm.Utils.html#newTemp"><span class="hs-identifier hs-var">newTemp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmType
</span><a href="GHC.Cmm.Type.html#bWord"><span class="hs-identifier hs-var">bWord</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681060989"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-723"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[(LocalReg, ForeignHint)]
-&gt; CLabel -&gt; [(CmmExpr, ForeignHint)] -&gt; Bool -&gt; FCode ()
</span><a href="GHC.StgToCmm.Utils.html#emitRtsCallGen"><span class="hs-identifier hs-var">emitRtsCallGen</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681060988"><span class="hs-identifier hs-var">bh</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ForeignHint
</span><a href="GHC.Cmm.Type.html#AddrHint"><span class="hs-identifier hs-var">AddrHint</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681060994"><span class="hs-identifier hs-var">newCAF_lbl</span></a></span><span>
</span><span id="line-724"></span><span>      </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmExpr
</span><a href="GHC.Cmm.Utils.html#baseExpr"><span class="hs-identifier hs-var">baseExpr</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">ForeignHint
</span><a href="GHC.Cmm.Type.html#AddrHint"><span class="hs-identifier hs-var">AddrHint</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-725"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681060996"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ForeignHint
</span><a href="GHC.Cmm.Type.html#AddrHint"><span class="hs-identifier hs-var">AddrHint</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-726"></span><span>      </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-727"></span><span>
</span><span id="line-728"></span><span>  </span><span class="hs-comment">-- see Note [atomic CAF entry] in rts/sm/Storage.c</span><span>
</span><span id="line-729"></span><span>  </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681060982"><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681060982"><span class="hs-identifier hs-var">updfr</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode WordOff
</span><a href="GHC.StgToCmm.Monad.html#getUpdFrameOff"><span class="hs-identifier hs-var">getUpdFrameOff</span></a></span><span>
</span><span id="line-730"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681060981"><span class="annot"><span class="annottext">target :: CmmExpr
</span><a href="#local-6989586621681060981"><span class="hs-identifier hs-var hs-var">target</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Info.html#entryCode"><span class="hs-identifier hs-var">entryCode</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681060989"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Info.html#closureInfoPtr"><span class="hs-identifier hs-var">closureInfoPtr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681060995"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681060996"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-731"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmAGraph -&gt; FCode ()) -&gt; FCode CmmAGraph -&gt; FCode ()
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; CmmAGraph -&gt; FCode CmmAGraph
</span><a href="GHC.StgToCmm.Monad.html#mkCmmIfThen"><span class="hs-identifier hs-var">mkCmmIfThen</span></a></span><span>
</span><span id="line-732"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmEqWord"><span class="hs-identifier hs-var">cmmEqWord</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681060989"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681060988"><span class="hs-identifier hs-var">bh</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#zeroExpr"><span class="hs-identifier hs-var">zeroExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681060989"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-733"></span><span>        </span><span class="hs-comment">-- re-enter the CAF</span><span>
</span><span id="line-734"></span><span>       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags
-&gt; Convention -&gt; CmmExpr -&gt; [CmmExpr] -&gt; WordOff -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkJump"><span class="hs-identifier hs-var">mkJump</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681060995"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeNodeCall"><span class="hs-identifier hs-var">NativeNodeCall</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681060981"><span class="hs-identifier hs-var">target</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">WordOff
</span><a href="#local-6989586621681060982"><span class="hs-identifier hs-var">updfr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-735"></span><span>
</span><span id="line-736"></span><span>  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode CmmExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681060988"><span class="hs-identifier hs-var">bh</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-737"></span><span>
</span><span id="line-738"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-739"></span><span class="hs-comment">--              Profiling</span><span>
</span><span id="line-740"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-741"></span><span>
</span><span id="line-742"></span><span class="hs-comment">-- For &quot;global&quot; data constructors the description is simply occurrence</span><span>
</span><span id="line-743"></span><span class="hs-comment">-- name of the data constructor itself.  Otherwise it is determined by</span><span>
</span><span id="line-744"></span><span class="hs-comment">-- @closureDescription@ from the let binding information.</span><span>
</span><span id="line-745"></span><span>
</span><span id="line-746"></span><span class="annot"><a href="GHC.StgToCmm.Bind.html#closureDescription"><span class="hs-identifier hs-type">closureDescription</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-747"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>            </span><span class="hs-comment">-- Module</span><span>
</span><span id="line-748"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>              </span><span class="hs-comment">-- Id of closure binding</span><span>
</span><span id="line-749"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-750"></span><span>        </span><span class="hs-comment">-- Not called for StgRhsCon which have global info tables built in</span><span>
</span><span id="line-751"></span><span>        </span><span class="hs-comment">-- CgConTbls.hs with a description generated from the data constructor</span><span>
</span><span id="line-752"></span><span id="closureDescription"><span class="annot"><span class="annottext">closureDescription :: DynFlags -&gt; Module -&gt; Name -&gt; String
</span><a href="GHC.StgToCmm.Bind.html#closureDescription"><span class="hs-identifier hs-var hs-var">closureDescription</span></a></span></span><span> </span><span id="local-6989586621681060974"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681060974"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681060973"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681060973"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span id="local-6989586621681060972"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681060972"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-753"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDocDump"><span class="hs-identifier hs-var">showSDocDump</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681060974"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&lt;'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-754"></span><span>                    </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isExternalName"><span class="hs-identifier hs-var">isExternalName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681060972"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-755"></span><span>                      </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681060972"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-comment">-- ppr will include the module name prefix</span><span>
</span><span id="line-756"></span><span>                      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Module -&gt; SDoc
</span><a href="GHC.Unit.Types.html#pprModule"><span class="hs-identifier hs-var">pprModule</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681060973"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681060972"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-757"></span><span>                    </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&gt;'</span></span><span class="hs-special">)</span><span>
</span><span id="line-758"></span><span>   </span><span class="hs-comment">-- showSDocDump, because we want to see the unique on the Name.</span><span>
</span><span id="line-759"></span></pre></body></html>